-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #117 from johnbieren/rhtaprel_816
feat(RHTAPREL-816): add translate-delivery-repo utility
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}" |