Skip to content

Commit 68d8877

Browse files
authored
fix(bundle): Fix containerImage tag in CSV from latest to real version (#1402)
Signed-off-by: Mat Kowalski <[email protected]>
1 parent cb761c5 commit 68d8877

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

.github/workflows/publish-operatorhub.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,34 +89,54 @@ jobs:
8989
echo "HANDLER_IMAGE_TAG=v${{ env.VERSION }}" >> $GITHUB_ENV
9090
echo "OPERATOR_IMAGE_TAG=v${{ env.VERSION }}" >> $GITHUB_ENV
9191
92-
- name: Generate bundle
92+
- name: Generate and validate bundle
9393
run: |
94+
# "make bundle" target runs generation and validations together
9495
make bundle VERSION=${{ env.VERSION }} \
9596
HANDLER_IMAGE_TAG=v${{ env.VERSION }} \
9697
OPERATOR_IMAGE_TAG=v${{ env.VERSION }} \
9798
HANDLER_PULL_POLICY=IfNotPresent \
9899
OPERATOR_PULL_POLICY=IfNotPresent
99100
100-
- name: Validate bundle
101+
- name: Validate versions in the bundle
101102
run: |
102-
make bundle VERSION=${{ env.VERSION }}
103+
CSV_FILE="bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml"
104+
103105
# Verify bundle was generated correctly
104-
if [ ! -f "bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml" ]; then
106+
if [ ! -f "$CSV_FILE" ]; then
105107
echo "Error: CSV file not found"
106108
exit 1
107109
fi
108110
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"
111+
# Verify containerImage annotation has correct version
112+
EXPECTED_CONTAINER_IMAGE="${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.OPERATOR_IMAGE_NAME }}:v${{ env.VERSION }}"
113+
ACTUAL_CONTAINER_IMAGE=$(grep "containerImage:" "$CSV_FILE" | awk '{print $2}')
114+
115+
if [ "$ACTUAL_CONTAINER_IMAGE" != "$EXPECTED_CONTAINER_IMAGE" ]; then
116+
echo "Error: containerImage annotation mismatch"
117+
echo " Expected: $EXPECTED_CONTAINER_IMAGE"
118+
echo " Actual: $ACTUAL_CONTAINER_IMAGE"
119+
exit 1
120+
fi
121+
122+
# Verify operator deployment image has correct version
123+
if ! grep -q "image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.OPERATOR_IMAGE_NAME }}:v${{ env.VERSION }}" "$CSV_FILE"; then
124+
echo "Error: Operator deployment image does not reference v${{ env.VERSION }}"
125+
exit 1
126+
fi
127+
128+
# Verify handler image has correct version
129+
if ! grep -q "image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_REPO }}/${{ env.HANDLER_IMAGE_NAME }}:v${{ env.VERSION }}" "$CSV_FILE"; then
130+
echo "Error: Handler image does not reference v${{ env.VERSION }}"
131+
exit 1
112132
fi
113133
114134
- name: Display bundle info
115135
run: |
116136
echo "Bundle contents:"
117137
ls -la bundle/
118138
echo "CSV file:"
119-
head -n 50 bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml
139+
cat bundle/manifests/${{ env.OPERATOR_NAME }}.clusterserviceversion.yaml
120140
121141
- name: Checkout OperatorHub repository
122142
if: ${{ github.event.inputs.create_pr == 'true' }}

0 commit comments

Comments
 (0)