Skip to content

Commit

Permalink
Adding Security-Compliance Branch Image Tagging Support
Browse files Browse the repository at this point in the history
  • Loading branch information
casey-williams-rh authored and psegedy committed Oct 6, 2023
1 parent 2a3c8d5 commit dc98a5c
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions build_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export TMPDIR=/var/lib/jenkins
IMAGE="quay.io/cloudservices/patchman-engine-app"
IMAGE_TAG=$(git rev-parse --short=7 HEAD)
IMAGE_VERSION=$(git tag --points-at $IMAGE_TAG)
SECURITY_COMPLIANCE_TAG="sc-$(date +%Y%m%d)-$(git rev-parse --short=7 HEAD)"

if [[ -z "$QUAY_USER" || -z "$QUAY_TOKEN" ]]; then
echo "QUAY_USER and QUAY_TOKEN must be set"
Expand All @@ -26,9 +27,15 @@ podman login -u="$QUAY_USER" -p="$QUAY_TOKEN" quay.io
podman login -u="$RH_REGISTRY_USER" -p="$RH_REGISTRY_TOKEN" registry.redhat.io
podman build -f Dockerfile -t "${IMAGE}:${IMAGE_TAG}" .
podman push "${IMAGE}:${IMAGE_TAG}"
podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest"
podman push "${IMAGE}:latest"
if [[ -n "$IMAGE_VERSION" ]]; then
podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:${IMAGE_VERSION}"
podman push "${IMAGE}:${IMAGE_VERSION}"

if [[ "$GIT_BRANCH" == "origin/security-compliance" ]]; then
podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:${SECURITY_COMPLIANCE_TAG}"
podman push "${IMAGE}:${SECURITY_COMPLIANCE_TAG}"
else
podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:latest"
podman push "${IMAGE}:latest"
if [[ -n "$IMAGE_VERSION" ]]; then
podman tag "${IMAGE}:${IMAGE_TAG}" "${IMAGE}:${IMAGE_VERSION}"
podman push "${IMAGE}:${IMAGE_VERSION}"
fi
fi

0 comments on commit dc98a5c

Please sign in to comment.