Skip to content

Commit

Permalink
Merge pull request #117 from johnbieren/rhtaprel_816
Browse files Browse the repository at this point in the history
feat(RHTAPREL-816): add translate-delivery-repo utility
  • Loading branch information
johnbieren authored Feb 6, 2024
2 parents 81e8d81 + bfa9f42 commit 0e10491
Showing 1 changed file with 30 additions and 0 deletions.
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}"

0 comments on commit 0e10491

Please sign in to comment.