Skip to content

Commit 6b9af41

Browse files
committed
Create dotenv file from publish script.
1 parent 57056ba commit 6b9af41

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

ci/input_files/build.yaml.tpl

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,7 @@ publish-layer-{{ $environment_name }} ({{ $runtime.name }}-{{ $runtime.arch }}):
175175
before_script:
176176
- EXTERNAL_ID_NAME={{ $environment.external_id }} ROLE_TO_ASSUME={{ $environment.role_to_assume }} AWS_ACCOUNT={{ $environment.account }} source ./ci/get_secrets.sh
177177
script:
178-
- |
179-
STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} ./ci/publish_layers.sh | tee publish.log
180-
# Extract the arn from the publish log to be used as envvar in e2e tests
181-
layer_arn="$(grep 'Published arn' publish.log | grep -oE 'arn:aws:lambda:.*')"
182-
if [ -z "$layer_arn" ]; then
183-
echo "Error: Layer ARN not found in publish log"
184-
exit 1
185-
else
186-
echo "Found layer arn, $layer_arn"
187-
fi
188-
echo "PYTHON_{{ $runtime.name | strings.Trim "python" }}_VERSION=$layer_arn" > {{ $dotenv }}
189-
cat {{ $dotenv }}
190-
178+
- STAGE={{ $environment_name }} PYTHON_VERSION={{ $runtime.python_version }} ARCH={{ $runtime.arch }} DOTENV={{ $dotenv }} ./ci/publish_layers.sh
191179

192180
{{- end }}
193181

ci/publish_layers.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,10 @@ while [ $latest_version -lt $VERSION ]; do
211211
fi
212212
done
213213

214+
if [ -n "$DOTENV" ]; then
215+
printf "[$REGION] Exporting layer version to $DOTENV file...\n"
216+
echo "PYTHON_${PYTHON_VERSION/./}_VERSION=$latest_arn" >> "$DOTENV"
217+
cat "$DOTENV"
218+
fi
219+
214220
printf "[$REGION] Finished publishing layers...\n\n"

0 commit comments

Comments
 (0)