Skip to content

Commit 2528f4a

Browse files
chore: turn environments into a dictionary
1 parent 544a96a commit 2528f4a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ci/datasources/environments.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
environments:
2-
- name: sandbox
2+
sandbox:
33
external_id: sandbox-publish-externalid
44
role_to_assume: sandbox-layer-deployer
55
account: 425362996713
6-
- name: prod
6+
prod:
77
external_id: prod-publish-externalid
88
role_to_assume: dd-serverless-layer-deployer-role
99
account: 464622532012

ci/input_files/build.yaml.tpl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ integration-test ({{ $runtime.name }}-{{ $runtime.arch }}):
103103
script:
104104
- RUNTIME_PARAM={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./scripts/run_integration_tests.sh
105105

106-
{{ range $environment := (ds "environments").environments }}
106+
{{ range $environment_name, $environment := (ds "environments").environments }}
107107

108-
{{ if or (eq $environment.name "prod") }}
108+
{{ if or (eq $environment_name "prod") }}
109109
sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}):
110110
stage: sign
111111
tags: ["arch:amd64"]
@@ -130,20 +130,20 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}):
130130
- apt-get install -y uuid-runtime
131131
- EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh
132132
script:
133-
- LAYER_FILE=datadog_lambda_py-{{ $runtime.arch}}-{{ $runtime.python_version }}.zip ./scripts/sign_layers.sh {{ $environment.name }}
133+
- LAYER_FILE=datadog_lambda_py-{{ $runtime.arch}}-{{ $runtime.python_version }}.zip ./scripts/sign_layers.sh {{ $environment_name }}
134134
{{ end }}
135135

136-
publish-layer-{{ $environment.name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
136+
publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
137137
stage: publish
138138
tags: ["arch:amd64"]
139139
image: registry.ddbuild.io/images/docker:20.10-py3
140140
rules:
141-
- if: '"{{ $environment.name }}" == "sandbox"'
141+
- if: '"{{ $environment_name }}" == "sandbox"'
142142
when: manual
143143
allow_failure: true
144144
- if: '$CI_COMMIT_TAG =~ /^v.*/'
145145
needs:
146-
{{ if or (eq $environment.name "prod") }}
146+
{{ if or (eq $environment_name "prod") }}
147147
- sign-layer ({{ $runtime.name }}-{{ $runtime.arch}})
148148
{{ else }}
149149
- build-layer ({{ $runtime.name }}-{{ $runtime.arch }})
@@ -153,7 +153,7 @@ publish-layer-{{ $environment.name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
153153
- integration-test ({{ $runtime.name }}-{{ $runtime.arch }})
154154
{{ end }}
155155
dependencies:
156-
{{ if or (eq $environment.name "prod") }}
156+
{{ if or (eq $environment_name "prod") }}
157157
- sign-layer ({{ $runtime.name }}-{{ $runtime.arch}})
158158
{{ else }}
159159
- build-layer ({{ $runtime.name }}-{{ $runtime.arch }})
@@ -166,7 +166,7 @@ publish-layer-{{ $environment.name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
166166
before_script:
167167
- EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh
168168
script:
169-
- STAGE={{ $environment.name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh
169+
- STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh
170170

171171
{{- end }}
172172

0 commit comments

Comments
 (0)