Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Security-Compliance Branch Image Tagging Support #1321

Merged
Merged
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
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
Loading