Skip to content

Commit

Permalink
Update Build-Deploy Script to support SC Manifest Builds
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-williams-rh committed Nov 13, 2023
1 parent e577212 commit a7b1c92
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -exv

IMAGE="quay.io/cloudservices/clowder"
IMAGE_TAG=$(git rev-parse --short=8 HEAD)
SECURITY_COMPLIANCE_TAG="sc-$(date +%Y%m%d)-$(git rev-parse --short=7 HEAD)"
SECURITY_COMPLIANCE_TAG="sc-$(date +%Y%m%d)-$(git rev-parse --short=8 HEAD)"

if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then
echo "QUAY_USER and QUAY_TOKEN must be set"
Expand Down Expand Up @@ -39,6 +39,11 @@ if [[ "$VALID_TAGS_LENGTH" -eq 0 ]]; then
docker --config="$DOCKER_CONF" push "$BASE_IMG"
fi

# If the "security-compliance" branch is used for the build, it will tag the image as such.
if [[ "$GIT_BRANCH" == "origin/security-compliance" ]]; then
IMAGE_TAG="$SECURITY_COMPLIANCE_TAG"
fi

make update-version
docker --config="$DOCKER_CONF" build --platform linux/amd64 --build-arg BASE_IMAGE="$BASE_IMG" -t "${IMAGE}:${IMAGE_TAG}-amd64" --push .
docker --config="$DOCKER_CONF" build --platform linux/arm64 --build-arg BASE_IMAGE="$BASE_IMG" -t "${IMAGE}:${IMAGE_TAG}-arm64" --push .
Expand All @@ -48,9 +53,3 @@ docker --config="$DOCKER_CONF" manifest create "${IMAGE}:${IMAGE_TAG}" \
"${IMAGE}:${IMAGE_TAG}-arm64"

docker --config="$DOCKER_CONF" manifest push "${IMAGE}:${IMAGE_TAG}"

# If the "security-compliance" branch is used for the build, it will tag the image as such.
if [[ $GIT_BRANCH == *"security-compliance"* ]]; then
docker --config="$DOCKER_CONF" tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:${SECURITY_COMPLIANCE_TAG}"
docker --config="$DOCKER_CONF" push "${IMAGE}:${SECURITY_COMPLIANCE_TAG}"
fi

0 comments on commit a7b1c92

Please sign in to comment.