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

feat(RHTAPREL-816): add translate-delivery-repo utility #117

Merged
merged 1 commit into from
Feb 6, 2024
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
30 changes: 30 additions & 0 deletions utils/translate-delivery-repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#
# script: translate-delivery-repo
#
# description: This script translates repo references to the proper public registry reference.
# It turns quay.io/redhat-prod/product----repo into registry.redhat.io/product/repo for production repos and
# quay.io/redhat-pending/product----repo -> registry.stage.redhat.io/product/repo for stage repos.
#
# example command:
# translate-delivery-repo REPO where REPO is quay.io/redhat-prod/product----repo for example
#

REPO=$1

if [ -z "${REPO}" ]; then
echo -e "Please pass a repo to translate like 'quay.io/redhat-prod/product----repo'"
exit
fi

if [[ "${REPO}" != "quay.io/redhat-prod"* && "${REPO}" != "quay.io/redhat-pending"* ]] ||
[[ "${REPO}" != *"----"* ]] ; then
echo Malformatted repo to translate. Expected format is quay.io/redhat-[prod,pending]/product----repo
exit 1
fi

REPO=${REPO/quay.io\/redhat-prod/registry.redhat.io}
REPO=${REPO/quay.io\/redhat-pending/registry.stage.redhat.io}
REPO=${REPO//----//}

echo "${REPO}"
Loading