Skip to content

Commit 2d1b5de

Browse files
lmicciniclaude
andcommitted
Fix pin-bundle-images.sh for operators with replace directives
When using LOCAL_REGISTRY=1 with operator replace directives pointing to non-standard GitHub users (e.g., personal forks), the script was trying to query the local registry for bundle images that don't exist there. This caused curl to return null/empty responses, leading to jq errors: "Cannot iterate over null (null)" and ultimately bundle-fail-tag being appended. The fix ensures that: - Operators with replace directives always query quay.io for bundles from the replaced user's namespace (e.g., quay.io/lmiccini/glance-operator-bundle) - Only standard openstack-k8s-operators bundles are queried from the local registry when LOCAL_REGISTRY=1 - Custom IMAGEBASE operators continue to work as before Fixes CI failures when depends-on references use operator replace directives. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 1cba828 commit 2d1b5de

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎hack/pin-bundle-images.sh‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ for MOD_PATH in ${MOD_PATHS}; do
4343
CURL_REGISTRY="quay.io"
4444
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/openstack-k8s-operators"
4545
REPO_URL="${CURL_REGISTRY}/openstack-k8s-operators"
46+
47+
# For bundle images, always use quay.io registry regardless of LOCAL_REGISTRY setting
48+
# when operators have replace directives pointing to non-standard users
4649
if [[ "$GITHUB_USER" != "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ]]; then
47-
if [[ "$IMAGENAMESPACE" != "openstack-k8s-operators" || "${IMAGEREGISTRY}" != "quay.io" ]]; then
50+
# If using a custom registry AND (it's for the base namespace OR not a replaced operator)
51+
if [[ "$IMAGENAMESPACE" != "openstack-k8s-operators" || "${IMAGEREGISTRY}" != "quay.io" ]] && [[ "$GITHUB_USER" == "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ]]; then
4852
REPO_URL="${IMAGEREGISTRY}/${IMAGENAMESPACE}"
4953
CURL_REGISTRY="${IMAGEREGISTRY}"
5054
# Quay registry v2 api does not return all the tags that's why keeping v1 for quay and v2
@@ -58,12 +62,16 @@ for MOD_PATH in ${MOD_PATHS}; do
5862
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/${IMAGENAMESPACE}"
5963
fi
6064
else
65+
# For replaced operators, always use quay.io with the GitHub user's namespace
66+
CURL_REGISTRY="quay.io"
6167
REPO_CURL_URL="https://${CURL_REGISTRY}/api/v1/repository/${GITHUB_USER}"
6268
REPO_URL="${CURL_REGISTRY}/${GITHUB_USER}"
6369
fi
6470
fi
6571

66-
if [[ ${LOCAL_REGISTRY} -eq 1 && ( "$GITHUB_USER" != "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ) ]]; then
72+
# For LOCAL_REGISTRY, only query it for standard operators or custom IMAGEBASE
73+
# Skip local registry for operators with replace directives (non-openstack-k8s-operators users)
74+
if [[ ${LOCAL_REGISTRY} -eq 1 && ( "$GITHUB_USER" == "openstack-k8s-operators" || "$BASE" == "$IMAGEBASE" ) ]]; then
6775
SHA=$(curl -s ${REPO_CURL_URL}/$BASE-operator-bundle/tags/list | jq -r .tags[] | sort -u | grep $REF)
6876
elif [[ "${CURL_REGISTRY}" == "docker.io" ]]; then
6977
SHA=$(curl -s ${REPO_CURL_URL}/$BASE-operator-bundle/tags/?page_size=100 | jq -r .results[].name | sort -u | grep $REF)

0 commit comments

Comments
 (0)