Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion mariadb-image-builder
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,25 @@ echo
# BUILDER_REGISTRY_PASSWORD is the password of the user
# BUILDER_REGISTRY_HOST is required if not using dockerhub, eg: `quay.io`
set -o errexit
echo "Logging in to registry"
echo $(echo "$IMAGE_BUILD_DATA" | jq -rc '.registryPassword') | docker login $(echo "$IMAGE_BUILD_DATA" | jq -rc '.registryHost') -u "$(echo "$IMAGE_BUILD_DATA" | jq -rc '.registryUsername')" --password-stdin

BUILDER_PUSH_TAGS=$(echo "$IMAGE_BUILD_DATA" | jq -rc '.pushTags')
# Push the image to remote
if [ "$BUILDER_PUSH_TAGS" == "both" ] || [ "$BUILDER_PUSH_TAGS" == "latest" ]; then
echo "Pushing to ${BUILDER_BACKUP_IMAGE_NAME}:latest"
docker push "${BUILDER_BACKUP_IMAGE_NAME}:latest"
if [ "$BUILDER_REMOVE_IMAGE" != "skip" ]; then
echo "Removing ${BUILDER_BACKUP_IMAGE_NAME}:latest"
docker rmi --force "${BUILDER_BACKUP_IMAGE_NAME}:latest"
fi
fi

if [ "$BUILDER_PUSH_TAGS" == "both" ] || [ "$BUILDER_PUSH_TAGS" == "default" ]; then
echo "Pushing to ${backup_image_full}"
docker push "${backup_image_full}"
if [ "$BUILDER_REMOVE_IMAGE" != "skip" ]; then
echo "Removing ${backup_image_full}"
docker rmi --force "${backup_image_full}"
fi
fi
Expand All @@ -204,4 +209,3 @@ echo "Finishing image-builder"
echo "========================"
currentStepEnd="$(date +"%Y-%m-%d %H:%M:%S")"
finalizeBuildStep "${buildStartTime}" "${previousStepEnd}" "${currentStepEnd}" "Save new container to registry"

Loading