Skip to content

Commit e7781e9

Browse files
committed
Subscript.
1 parent 82b3ee1 commit e7781e9

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ default:
3333
- apt-get install nodejs -y
3434
- npm install --global yarn
3535

36+
# Extract the arn from the publish log to be used as envvar in e2e tests
37+
.extract-arn: &extract-arn
38+
- |
39+
layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')"
40+
if [ -z "$layer_arn" ]; then
41+
echo "Error: Layer ARN not found in publish log"
42+
exit 1
43+
else
44+
echo "Found layer arn, $layer_arn"
45+
fi
46+
echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }}
47+
3648
{{ range $runtime := (ds "runtimes").runtimes }}
3749

3850
# TODO(astuyve) - figure out python build cache
@@ -149,8 +161,6 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
149161
allow_failure: true
150162
- if: '$CI_COMMIT_TAG =~ /^v.*/'
151163
artifacts:
152-
paths:
153-
- {{ $dotenv }}
154164
reports:
155165
dotenv: {{ $dotenv }}
156166
needs:
@@ -177,22 +187,8 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
177187
before_script:
178188
- EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh
179189
script:
180-
- |
181-
set -x
182-
STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log
183-
# Extract the arn from the publish log to be used as envvar in e2e tests
184-
cat publish.log
185-
grep 'Published arn' publish.log
186-
grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*'
187-
layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')"
188-
if [ -z "$layer_arn" ]; then
189-
echo "Error: Layer ARN not found in publish log"
190-
exit 1
191-
else
192-
echo "Found layer arn: $layer_arn"
193-
fi
194-
echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }}
195-
cat {{ $dotenv }}
190+
- STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log
191+
- *extract-arn
196192

197193

198194
{{- end }}
@@ -267,6 +263,8 @@ e2e-test:
267263
strategy: depend
268264
variables:
269265
LANGUAGES_SUBSET: python
266+
before_script:
267+
- env
270268
needs: {{ range (ds "runtimes").runtimes }}
271269
{{- if eq .arch "amd64" }}
272270
- "publish-layer-sandbox ({{ .name }}-{{ .arch }}): [{{ $e2e_region }}]"

0 commit comments

Comments
 (0)