Skip to content

Commit

Permalink
Merge pull request #2682 from cyberark/fix-redhat-push
Browse files Browse the repository at this point in the history
Fix Redhat image push
  • Loading branch information
gl-johnson authored Nov 29, 2022
2 parents 6928f0f + e830a19 commit 193ed82
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions publish-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ LOCAL_IMAGE="conjur:${LOCAL_TAG}"
RH_LOCAL_IMAGE="conjur-ubi:${LOCAL_TAG}"
IMAGE_NAME="cyberark/conjur"
REDHAT_CERT_PID="5f905d433a93dc782c77a0f9"
REDHAT_IMAGE="scan.connect.redhat.com/ospid-9fb7aea1-0c01-4527-8def-242f3cde7dc6/conjur"
REDHAT_REGISTRY="quay.io"
REDHAT_REMOTE_IMAGE="${REDHAT_REGISTRY}/redhat-isv-containers/${REDHAT_CERT_PID}"
REDHAT_USER="redhat-isv-containers+${REDHAT_CERT_PID}-robot"

# Normalize version number in the case of '+' included
VERSION="$(echo -n "${VERSION}" | tr "+" "_")"
Expand Down Expand Up @@ -134,14 +136,14 @@ fi
if [[ "${REDHAT}" = true ]]; then
echo "Publishing ${VERSION} to RedHat registry..."
# Publish only the tag version to the Redhat container registry
if docker login scan.connect.redhat.com -u unused -p "${REDHAT_API_KEY}"; then
if docker login "${REDHAT_REGISTRY}" -u "${REDHAT_USER}" -p "${REDHAT_API_KEY}"; then
# push image to red hat
tag_and_push "${VERSION}" "${RH_LOCAL_IMAGE}" "${REDHAT_IMAGE}"
tag_and_push "${VERSION}" "${RH_LOCAL_IMAGE}" "${REDHAT_REMOTE_IMAGE}"

# scan image with preflight tool
scan_redhat_image "${REDHAT_IMAGE}:${VERSION}" "${REDHAT_CERT_PID}"
scan_redhat_image "${REDHAT_REMOTE_IMAGE}:${VERSION}" "${REDHAT_CERT_PID}"
else
echo 'Failed to log in to scan.connect.redhat.com'
echo 'Failed to log in to quay.io'
exit 1
fi
fi
fi

0 comments on commit 193ed82

Please sign in to comment.