Skip to content

Commit c59ba03

Browse files
committed
Use variables.
1 parent 9e62357 commit c59ba03

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{- $e2e_region := "us-west-2" -}}
2+
13
stages:
24
- build
35
- test
@@ -133,21 +135,24 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}):
133135
- LAYER_FILE=datadog_lambda_py-{{ $runtime.arch}}-{{ $runtime.python_version }}.zip ./scripts/sign_layers.sh prod
134136

135137
{{ range $environment_name, $environment := (ds "environments").environments }}
138+
{{ $dotenv := print $runtime.name "_" $runtime.arch "_" $environment_name ".env" }}
136139

137140
publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
138141
stage: publish
139142
tags: ["arch:amd64"]
140143
image: registry.ddbuild.io/images/docker:20.10-py3
141144
rules:
142-
- if: '"{{ $environment_name }}" == "sandbox" && $REGION == "us-west-2" && "{{ $runtime.arch }}" == "amd64"'
145+
- if: '"{{ $environment_name }}" == "sandbox" && $REGION == "{{ $e2e_region }}" && "{{ $runtime.arch }}" == "amd64"'
143146
when: always
144147
- if: '"{{ $environment_name }}" == "sandbox"'
145148
when: manual
146149
allow_failure: true
147150
- if: '$CI_COMMIT_TAG =~ /^v.*/'
148151
artifacts:
152+
paths:
153+
- {{ $dotenv }}
149154
reports:
150-
dotenv: layer_version
155+
dotenv: {{ $dotenv }}
151156
needs:
152157
{{ if or (eq $environment_name "prod") }}
153158
- sign-layer ({{ $runtime.name }}-{{ $runtime.arch}})
@@ -174,7 +179,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
174179
script:
175180
- STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log
176181
# Extract the arn from the publish log to be used as envvar in e2e tests
177-
- echo "PYTHON_{{ $runtime.python_version | strings.ReplaceAll "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > layer_version
182+
- echo "PYTHON_{{ $runtime.python_version | strings.ReplaceAll "." "" }}_VERSION=$(grep -oP 'Published arn \K\.*' publish.log)" > {{ $dotenv }}
178183

179184
{{- end }}
180185

@@ -256,6 +261,6 @@ e2e-test:
256261
PYTHON_313_VERSION: latest
257262
needs: {{ range (ds "runtimes").runtimes }}
258263
{{- if eq .arch "amd64" }}
259-
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [us-west-2]"
264+
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]"
260265
{{- end }}
261266
{{- end }}

0 commit comments

Comments
 (0)