Skip to content

Commit 80b517c

Browse files
committed
fix(bundle): Fix containerImage tag in CSV from latest to real version
Signed-off-by: Mat Kowalski <[email protected]>
1 parent 9d463b7 commit 80b517c

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

.github/workflows/publish-operatorhub.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,20 +97,52 @@ jobs:
9797
HANDLER_PULL_POLICY=IfNotPresent \
9898
OPERATOR_PULL_POLICY=IfNotPresent
9999
100+
- name: Update containerImage annotation in CSV
101+
run: |
102+
CSV_FILE="bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml"
103+
104+
# Update the containerImage annotation to reference the correct version
105+
sed -i "s|containerImage: quay.io/nmstate/kubernetes-nmstate-operator:.*|containerImage: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.OPERATOR_IMAGE_NAME }}:v${{ env.VERSION }}|g" "$CSV_FILE"
106+
107+
echo "Updated containerImage annotation to:"
108+
grep "containerImage:" "$CSV_FILE"
109+
100110
- name: Validate bundle
101111
run: |
102-
make bundle VERSION=${{ env.VERSION }}
112+
CSV_FILE="bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml"
113+
103114
# Verify bundle was generated correctly
104-
if [ ! -f "bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml" ]; then
115+
if [ ! -f "$CSV_FILE" ]; then
105116
echo "Error: CSV file not found"
106117
exit 1
107118
fi
108119
109-
# Check that images reference the correct version
110-
if ! grep -q "${{ steps.version.outputs.tag }}" "bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml"; then
111-
echo "Warning: CSV may not reference the correct image tag"
120+
# Verify containerImage annotation has correct version
121+
EXPECTED_CONTAINER_IMAGE="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.OPERATOR_IMAGE_NAME }}:v${{ env.VERSION }}"
122+
ACTUAL_CONTAINER_IMAGE=$(grep "containerImage:" "$CSV_FILE" | awk '{print $2}')
123+
124+
if [ "$ACTUAL_CONTAINER_IMAGE" != "$EXPECTED_CONTAINER_IMAGE" ]; then
125+
echo "Error: containerImage annotation mismatch"
126+
echo " Expected: $EXPECTED_CONTAINER_IMAGE"
127+
echo " Actual: $ACTUAL_CONTAINER_IMAGE"
128+
exit 1
129+
fi
130+
131+
# Verify operator deployment image has correct version
132+
if ! grep -q "image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.OPERATOR_IMAGE_NAME }}:v${{ env.VERSION }}" "$CSV_FILE"; then
133+
echo "Error: Operator deployment image does not reference v${{ env.VERSION }}"
134+
exit 1
135+
fi
136+
137+
# Verify handler image has correct version
138+
if ! grep -q "image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.HANDLER_IMAGE_NAME }}:v${{ env.VERSION }}" "$CSV_FILE"; then
139+
echo "Error: Handler image does not reference v${{ env.VERSION }}"
140+
exit 1
112141
fi
113142
143+
# Run bundle validation
144+
make bundle VERSION=${{ env.VERSION }}
145+
114146
- name: Display bundle info
115147
run: |
116148
echo "Bundle contents:"

0 commit comments

Comments
 (0)