Skip to content

Commit

Permalink
CNJR-5954: Push unified manifest to DockerHub
Browse files Browse the repository at this point in the history
  • Loading branch information
szh committed Sep 13, 2024
1 parent ebc15ca commit c40c5d5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ if (params.MODE == "PROMOTE") {
summon -f ./secrets.yml ./publish-images.sh --promote --base-version=${sourceVersion} --version=${targetVersion} --arch=arm64
# Promote manifest that links above images
summon -f ./secrets.yml ./publish-manifest.sh --promote --base-version=${sourceVersion} --version=${targetVersion}
summon -f ./secrets.yml ./publish-manifest.sh --promote --dockerhub --base-version=${sourceVersion} --version=${targetVersion}
"""

// TODO: In talking to Neil King, this likely won't work until conjurops is migrated over
Expand Down
4 changes: 2 additions & 2 deletions publish-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ if [[ "${REDHAT}" = true ]]; then
# Publish only the tag version to the Redhat container registry
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_REMOTE_IMAGE}"
tag_and_push "${VERSION}" "${RH_LOCAL_IMAGE}-${ARCH}" "${REDHAT_REMOTE_IMAGE}"

# scan image with preflight tool
scan_redhat_image "${REDHAT_REMOTE_IMAGE}:${VERSION}" "${REDHAT_CERT_PID}"

# push latest tag to RH
tag_and_push "latest" "${RH_LOCAL_IMAGE}" "${REDHAT_REMOTE_IMAGE}"
tag_and_push "latest" "${RH_LOCAL_IMAGE}-${ARCH}" "${REDHAT_REMOTE_IMAGE}"
else
echo 'Failed to log in to quay.io'
exit 1
Expand Down
20 changes: 20 additions & 0 deletions publish-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function print_help() {
PUBLISH_EDGE=false
PUBLISH_INTERNAL=false
PROMOTE=false
DOCKERHUB=false
VERSION=$(<VERSION)

LOCAL_TAG="$(version_tag)"
Expand All @@ -40,6 +41,10 @@ for arg in "$@"; do
PROMOTE=true
shift
;;
--dockerhub )
DOCKERHUB=true
shift
;;
--version=* )
VERSION="${arg#*=}"
shift
Expand Down Expand Up @@ -86,6 +91,14 @@ if [[ "${PUBLISH_EDGE}" = true ]]; then
# Push manifest to internal registry
prepare_manifest "registry.tld/${IMAGE_NAME}" "edge"
prepare_manifest "registry.tld/conjur-ubi" "edge"

# Publish manifests to dockerhub
if [[ "${DOCKERHUB}" = true ]]; then
echo "Pushing to DockerHub"

prepare_manifest "${IMAGE_NAME}" "${VERSION}"
prepare_manifest "${IMAGE_NAME}" "edge"
fi
fi

if [[ "${PROMOTE}" = true ]]; then
Expand All @@ -99,5 +112,12 @@ if [[ "${PROMOTE}" = true ]]; then

prepare_manifest "registry.tld/${IMAGE_NAME}" "${version}"
prepare_manifest "registry.tld/conjur-ubi" "${version}"

# Publish manifests to dockerhub
if [[ "${DOCKERHUB}" = true ]]; then
echo "Pushing to DockerHub"

prepare_manifest "${IMAGE_NAME}" "${version}"
fi
done
fi

0 comments on commit c40c5d5

Please sign in to comment.