Skip to content

Commit f2722b2

Browse files
Fix buildspec tagging and codebuild error handling (#995)
* update buildspec with set -e * fix al2 buildspec tags
1 parent c2c3fa7 commit f2722b2

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

buildspec.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ phases:
2020
# Execute build commands based on BUILD_VERSION
2121
- |
2222
if [ "$BUILD_VERSION" = "2" ]; then
23+
# need this for multiline code blocks to raise any errors to codebuild
24+
set -e
2325
echo "Building AWS for Fluent Bit version 2 (current behavior)"
2426
2527
# Check latest image versions from dockerhub and from GitHub source file
@@ -39,16 +41,16 @@ phases:
3941
# Push the image to ECR with corresponding architecture as the tag.
4042
aws ecr get-login-password --region ${AWS_REGION}| docker login --username AWS --password-stdin ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com
4143
aws ecr create-repository --repository-name amazon/aws-for-fluent-bit-test --image-scanning-configuration scanOnPush=true --region ${AWS_REGION} || true
42-
architecture=$(docker inspect --format='{{.Architecture}}' amazon/aws-for-fluent-bit)
43-
docker tag amazon/aws-for-fluent-bit:latest ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture
44-
docker tag amazon/aws-for-fluent-bit:debug ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture-debug
44+
architecture=$(docker inspect --format='{{.Architecture}}' amazon/aws-for-fluent-bit:latest-al2)
45+
docker tag amazon/aws-for-fluent-bit:latest-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture
46+
docker tag amazon/aws-for-fluent-bit:debug-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture-debug
4547
docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture
4648
docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:$architecture-debug
4749
./scripts/publish.sh cicd-verify-ecr-image-scan ${AWS_REGION} amazon/aws-for-fluent-bit-test $architecture
4850
./scripts/publish.sh cicd-verify-ecr-image-scan ${AWS_REGION} amazon/aws-for-fluent-bit-test $architecture-debug
4951
# Image with Init Process
50-
docker tag amazon/aws-for-fluent-bit:init-latest ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture
51-
docker tag amazon/aws-for-fluent-bit:init-debug ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture-debug
52+
docker tag amazon/aws-for-fluent-bit:init-latest-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture
53+
docker tag amazon/aws-for-fluent-bit:init-debug-al2 ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture-debug
5254
docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture
5355
docker push ${AWS_ACCOUNT}.dkr.ecr.${AWS_REGION}.amazonaws.com/amazon/aws-for-fluent-bit-test:init-$architecture-debug
5456
./scripts/publish.sh cicd-verify-ecr-image-scan ${AWS_REGION} amazon/aws-for-fluent-bit-test init-$architecture

buildspec_integ.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ phases:
1919
# Execute integration test commands based on BUILD_VERSION
2020
- |
2121
if [ "$BUILD_VERSION" = "2" ]; then
22+
# need this for multiline code blocks to raise any errors to codebuild
23+
set -e
2224
echo "Running integration tests for AWS for Fluent Bit version 2 (current behavior)"
2325
2426
# Enforce STS regional endpoints

buildspec_load_test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ phases:
5959
# Execute load test commands based on BUILD_VERSION
6060
- |
6161
if [ "$BUILD_VERSION" = "2" ]; then
62+
# need this for multiline code blocks to raise any errors to codebuild
63+
set -e
6264
echo "Running load tests for AWS for Fluent Bit version 2 (current behavior)"
6365
6466
# Activate Python virtual environment and install the AWS CDK core dependencies

0 commit comments

Comments
 (0)