Skip to content

Commit

Permalink
Merge pull request #5 from Sage/stop_wrong_image_push_for_qa_target_tag
Browse files Browse the repository at this point in the history
fix for addons last-successful-build images failures
  • Loading branch information
LauraCollins-Sage committed Aug 23, 2022
2 parents 0cc9a62 + a696cb7 commit c9c3ff4
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions hooks/post-command
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,22 @@ if [[ $ACTION == "push_image" ]];then

# For dev, other images like database and test and master should be pushed.
if [[ "$ENVIRONMENT" == "qa" ]]; then
INITIAL_BK_BRANCH="$BK_BRANCH"

# Push a special image based on a merge to the default branch (e.g. master or main)
if [[ "$BK_BRANCH" == "$BUILDKITE_PIPELINE_DEFAULT_BRANCH" ]]; then
echo "$BUILDKITE_PIPELINE_DEFAULT_BRANCH test image "
BK_BRANCH="test-$BK_BRANCH"
push_image --account_id $ACCOUNT_ID --app $APP --tag test --multiarch $MULTIARCH_IMAGE_PUSH
fi

if [[ "$HAS_DB_IMAGE" == "true" ]]; then
echo "DB image"
BK_BRANCH="database-$INITIAL_BK_BRANCH"
push_image --account_id $ACCOUNT_ID --app $APP --tag database --multiarch false
# unless we have set TARGET_TAG - as it will push multiple images to the same tag.
if [[ -z $TARGET_TAG ]]; then
INITIAL_BK_BRANCH="$BK_BRANCH"

# Push a special image based on a merge to the default branch (e.g. master or main)
if [[ "$BK_BRANCH" == "$BUILDKITE_PIPELINE_DEFAULT_BRANCH" ]]; then
echo "$BUILDKITE_PIPELINE_DEFAULT_BRANCH test image "
BK_BRANCH="test-$BK_BRANCH"
push_image --account_id $ACCOUNT_ID --app $APP --tag test --multiarch $MULTIARCH_IMAGE_PUSH
fi

if [[ "$HAS_DB_IMAGE" == "true" ]]; then
echo "DB image"
BK_BRANCH="database-$INITIAL_BK_BRANCH"
push_image --account_id $ACCOUNT_ID --app $APP --tag database --multiarch false
fi
fi
fi
elif [[ $ACTION == "push_param" ]];then
Expand Down

0 comments on commit c9c3ff4

Please sign in to comment.