Repository navigation
Expand file tree
/
Copy pathcopier.yml
More file actions
76 lines (69 loc) · 3.05 KB
/
Copy pathcopier.yml
File metadata and controls
76 lines (69 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# The CML overlay: two Copier templates that vendor the spoke files into a repo, applied
# after its own template. `layer` picks one, and each keeps its own answers file:
# project run_scheduled.sh and the app's telemetry settings, in every project repo
# (.copier-answers.cml.yml)
# host the Alloy agent and the GPU exporter, once per machine, in the repo that
# owns the machine (.copier-answers.cml-host.yml, so pass --answers-file)
# Each renders templates/spoke/<layer>/ only. templates/README.md has the steps.
_min_copier_version: "9.19.1"
_subdirectory: "templates/spoke/{{ layer }}"
_answers_file: .copier-answers.cml.yml
# Only *.jinja files render; the vendored files are copied byte for byte.
_templates_suffix: .jinja
_exclude:
- "{% if not (gpu | default(false)) %}compose.telemetry.gpu.yml{% endif %}"
layer:
type: str
help: Which layer to render (project, or host with --answers-file .copier-answers.cml-host.yml)
choices: [project, host]
default: project
# Two layers sharing one answers file would overwrite each other's answers.
validator: >-
{%- set want = '.copier-answers.cml' ~ ('' if layer == 'project' else '-host') ~ '.yml' -%}
{%- if (_copier_conf.answers_file | string) != want -%}
the {{ layer }} layer needs --answers-file {{ want }}
{%- endif %}
project:
type: str
help: >-
Project name, the `project` label (as passed to bootstrap.sh). For a host, the project
that owns the machine, whose labels the host-level series carry.
validator: >-
{% if not (project | regex_search('^[a-z0-9][a-z0-9-]*\\Z')) %}must match [a-z0-9][a-z0-9-]*{% endif %}
env:
type: str
help: Environment, the `env` label (as passed to bootstrap.sh)
default: prod
validator: >-
{% if not (env | regex_search('^[a-z0-9][a-z0-9-]*\\Z')) %}must match [a-z0-9][a-z0-9-]*{% endif %}
otlp_endpoint:
type: str
help: The hub's OTLP/HTTP endpoint
default: https://otel.cml-relab.org
validator: >-
{% if not otlp_endpoint.startswith('https://') %}must be an https:// URL{% endif %}
contact:
type: str
help: Who to ask about this project's telemetry (an email address; empty for none)
default: ""
when: "{{ layer == 'project' }}"
gpu:
type: bool
help: Does the machine have an NVIDIA GPU? Adds compose.telemetry.gpu.yml.
default: false
when: "{{ layer == 'host' }}"
stacks:
type: str
help: >-
The Compose projects on the machine to ship, as compose-project=project/env, space
separated (`cmlops=cmlops/prod r9lab_staging=r9lab/staging`). Other containers are not shipped.
default: "{{ project }}={{ project }}/{{ env }}"
when: "{{ layer == 'host' }}"
validator: >-
{%- set pair = '[a-z0-9][a-z0-9_-]*=[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9-]*' -%}
{%- if not (stacks | regex_search('^' ~ pair ~ '( ' ~ pair ~ ')*\\Z')) -%}
must be compose-project=project/env pairs separated by spaces
{%- elif (stacks.split() | map('regex_replace', '=.*$', '') | unique | list | length)
!= (stacks.split() | length) -%}
each Compose project must appear only once
{%- endif %}