Skip to content

Commit cb63213

Browse files
committed
Allow to provide an operator custom tag in pin-bundle
This patch allow us to provide a custom tag to service operator, defined by IMAGEBASE, while pinning all bundles using 'pin-bundle-images' script. This will enable us to build bundles with custom tags in Prow, avoiding conflicts with concurrent jobs.
1 parent ca1faeb commit cb63213

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

hack/pin-bundle-images.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ DOCKERFILE=${DOCKERFILE:-""}
88
IMAGENAMESPACE=${IMAGENAMESPACE:-"openstack-k8s-operators"}
99
IMAGEREGISTRY=${IMAGEREGISTRY:-"quay.io"}
1010
IMAGEBASE=${IMAGEBASE:-}
11+
IMAGECUSTOMTAG=${IMAGECUSTOMTAG:-}
1112
LOCAL_REGISTRY=${LOCAL_REGISTRY:-0}
1213

1314
if [ -n "$DOCKERFILE" ]; then
@@ -26,10 +27,17 @@ for MOD_PATH in $(go list -mod=readonly -m -json all | jq -r '. | select(.Path |
2627

2728
GIT_REPO=${MOD_PATH%"/apis"}
2829
GIT_REPO=${GIT_REPO%"/api"}
29-
REF=$(echo $MOD_VERSION | sed -e 's|v[0-9]*.[0-9]*.[0-9]*-.*[0-9]*-\(.*\)$|\1|')
30-
if [[ "$REF" == v* ]]; then
31-
REF=$(git ls-remote https://${GIT_REPO} | grep ${REF} | awk 'NR==1{print $1}')
30+
31+
# Check if there is a custom tag for IMAGEBASE operator
32+
if [[ -n "$IMAGECUSTOMTAG" && "$BASE" == "$IMAGEBASE" ]]; then
33+
REF=${IMAGECUSTOMTAG}
34+
else
35+
REF=$(echo $MOD_VERSION | sed -e 's|v[0-9]*.[0-9]*.[0-9]*-.*[0-9]*-\(.*\)$|\1|')
36+
if [[ "$REF" == v* ]]; then
37+
REF=$(git ls-remote https://${GIT_REPO} | grep ${REF} | awk 'NR==1{print $1}')
38+
fi
3239
fi
40+
3341
GITHUB_USER=$(echo $MOD_PATH | sed -e 's|github.com/\(.*\)/.*-operator/.*$|\1|')
3442
CURL_REGISTRY="quay.io"
3543
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/openstack-k8s-operators"

0 commit comments

Comments
 (0)