From 8c366f159504c9a3901a418c1822a408a11fb6ab Mon Sep 17 00:00:00 2001 From: Phil Atkinson Date: Mon, 16 Aug 2021 17:15:09 +0100 Subject: [PATCH] fix: abort on failure --- buildspec.yaml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/buildspec.yaml b/buildspec.yaml index fa619f9..65e3fae 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -2,17 +2,21 @@ version: 0.2 phases: pre_build: + on-failure: ABORT commands: - - echo Logging in to Amazon ECR... + # output version + - echo source version $CODEBUILD_SOURCE_VERSION + - echo build number $CODEBUILD_BUILD_NUMBER + # Logging in to Amazon ECR... - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com build: + on-failure: ABORT commands: - - echo Build started on `date` - - echo Building the Docker image... + # Building the "production" Docker image - docker build --target production -t $IMAGE_REPO_NAME:$IMAGE_TAG . - docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG post_build: + on-failure: ABORT commands: - - echo Build completed on `date` - - echo Pushing the Docker image... + # Pushing the Docker image to your ECR - docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$IMAGE_TAG \ No newline at end of file