@@ -103,9 +103,6 @@ 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 }}
107-
108- {{ if or (eq $environment .name " prod" ) }}
109106sign-layer ({{ $runtime .name }}-{{ $runtime .arch }}):
110107 stage: sign
111108 tags: [" arch:amd64" ]
@@ -128,22 +125,25 @@ sign-layer ({{ $runtime.name }}-{{ $runtime.arch }}):
128125 before_script:
129126 - apt-get update
130127 - apt-get install -y uuid-runtime
128+ {{ with $environment := (ds " environments" ).environments.prod }}
131129 - EXTERNAL_ID_NAME= {{ $environment .external_id }} ROLE_TO_ASSUME= {{ $environment .role_to_assume }} AWS_ACCOUNT= {{ $environment .account }} source . /ci/get_secrets.sh
130+ {{ end }}
132131 script:
133- - LAYER_FILE= datadog_lambda_py-{{ $runtime .arch }}-{{ $runtime .python_version }}.zip . /scripts/sign_layers.sh {{ $environment .name }}
134- {{ end }}
132+ - LAYER_FILE= datadog_lambda_py-{{ $runtime .arch }}-{{ $runtime .python_version }}.zip . /scripts/sign_layers.sh prod
133+
134+ {{ range $environment_name , $environment := (ds " environments" ).environments }}
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| staging)/ '
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
@@ -186,3 +186,49 @@ publish-pypi-package:
186186 {{- end }}
187187 script:
188188 - . /ci/publish_pypi.sh
189+
190+ layer bundle:
191+ stage: build
192+ tags: [" arch:amd64" ]
193+ image: registry.ddbuild.io /images/docker:20.10
194+ needs:
195+ {{ range (ds " runtimes" ).runtimes }}
196+ - build-layer ({{ .name }}-{{ .arch }})
197+ {{ end }}
198+ dependencies:
199+ {{ range (ds " runtimes" ).runtimes }}
200+ - build-layer ({{ .name }}-{{ .arch }})
201+ {{ end }}
202+ artifacts:
203+ expire_in: 1 hr
204+ paths:
205+ - datadog_lambda_py-bundle-$ {CI_JOB_ID}/
206+ name: datadog_lambda_py-bundle-$ {CI_JOB_ID}
207+ script:
208+ - rm -rf datadog_lambda_py-bundle-$ {CI_JOB_ID}
209+ - mkdir -p datadog_lambda_py-bundle-$ {CI_JOB_ID}
210+ - cp .layers /datadog_lambda_py-*.zip datadog_lambda_py-bundle-$ {CI_JOB_ID}
211+
212+ signed layer bundle:
213+ stage: sign
214+ image: registry.ddbuild.io /images/docker:20.10 -py3
215+ tags: [" arch:amd64" ]
216+ rules:
217+ - if : '$CI_COMMIT_TAG = ~ /^v. */'
218+ needs:
219+ {{ range (ds " runtimes" ).runtimes }}
220+ - sign-layer ({{ .name }}-{{ .arch }})
221+ {{ end }}
222+ dependencies:
223+ {{ range (ds " runtimes" ).runtimes }}
224+ - sign-layer ({{ .name }}-{{ .arch }})
225+ {{ end }}
226+ artifacts:
227+ expire_in: 1 day
228+ paths:
229+ - datadog_lambda_py-signed-bundle-$ {CI_JOB_ID}/
230+ name: datadog_lambda_py-signed-bundle-$ {CI_JOB_ID}
231+ script:
232+ - rm -rf datadog_lambda_py-signed-bundle-$ {CI_JOB_ID}
233+ - mkdir -p datadog_lambda_py-signed-bundle-$ {CI_JOB_ID}
234+ - cp .layers /datadog_lambda_py-*.zip datadog_lambda_py-signed-bundle-$ {CI_JOB_ID}
0 commit comments