Repository navigation
Expand file tree
/
Copy pathbuildspec.deploy-tools.yml
More file actions
43 lines (37 loc) · 1.61 KB
/
Copy pathbuildspec.deploy-tools.yml
File metadata and controls
43 lines (37 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
version: 0.2
env:
variables:
IMAGE_NAME: deploy-tools
REPOSITORY_URI: public.ecr.aws/uktrade/platform-deploy-tools
phases:
pre_build:
commands:
- test -n "$PLATFORM_HELPER_VERSION" || (echo "PLATFORM_HELPER_VERSION is required" && exit 1)
- |
echo "Waiting for new Platform Helper version ${PLATFORM_HELPER_VERSION} to become available..."
for i in $(seq 1 60); do
if curl -fsS "https://pypi.org/simple/dbt-platform-helper/" | grep -q "dbt_platform_helper-${PLATFORM_HELPER_VERSION}-"; then
echo "dbt-platform-helper ${PLATFORM_HELPER_VERSION} is available"
break
fi
if [ "$i" -eq 60 ]; then
echo "dbt-platform-helper ${PLATFORM_HELPER_VERSION} was not available after 5 minutes"
exit 1
fi
echo "Attempt $i/60: package not available yet; retrying in 5 seconds..."
sleep 5
done
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
build:
commands:
- docker build -f images/tools/deploy/Dockerfile --build-arg PLATFORM_HELPER_VERSION="$PLATFORM_HELPER_VERSION" -t "$REPOSITORY_URI:$PLATFORM_HELPER_VERSION" .
- docker tag "$REPOSITORY_URI:$PLATFORM_HELPER_VERSION" "$REPOSITORY_URI:latest"
post_build:
commands:
- |
if [ "$CODEBUILD_BUILD_SUCCEEDING" = "1" ]; then
docker push "$REPOSITORY_URI:$PLATFORM_HELPER_VERSION"
docker push "$REPOSITORY_URI:latest"
else
echo "Skipping image push because the build failed"
fi