Skip to content

Commit b329765

Browse files
authored
fix: update component to MofedStigFips and use local var in loop for setting component versions in release workflow (Mellanox#1818)
changes: - fix: update component MofedStig to MofedStig**Fips** (line 300). - fix: use separate local variable when determining component tag in release workflow (lines 250-259). - fix: set '-stig-fips' component tag when relevant when waiting for images. - chore: cleanup of trailing whitespace (rest of diff). - nit: use single image_url var instead of 3 vars.
2 parents ba5116c + 0879109 commit b329765

File tree

1 file changed

+30
-22
lines changed

1 file changed

+30
-22
lines changed

.github/workflows/release.yaml

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
# name of the release branch for downstream components
3131
RELEASE_BRANCH=network-operator-${MAJOR_MINOR_X}
3232
echo "release_branch=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT
33-
33+
3434
# tag for components
3535
TAG="network-operator-${APP_VERSION}"
3636
echo "component_tag=${TAG}" >> $GITHUB_OUTPUT
@@ -89,8 +89,8 @@ jobs:
8989
repos=$(yq -o=json 'to_entries | map(select(.value.sourceRepository != null) | .value.sourceRepository)' hack/release.yaml | jq -c 'unique')
9090
echo "Managed repositories: $repos"
9191
echo "managed_repos=$(echo $repos)" >> $GITHUB_OUTPUT
92-
93-
# Extract image names with repository for components that have sourceRepository
92+
93+
# Extract image names with repository for components that have sourceRepository
9494
images=$(yq 'to_entries | map(select(.value.sourceRepository != null) | .value.image) | join(" ")' hack/release.yaml)
9595
echo "Managed images: $images"
9696
echo "managed_images=$images" >> $GITHUB_OUTPUT
@@ -160,20 +160,26 @@ jobs:
160160
- name: Wait for images to be available
161161
run: |
162162
echo "Waiting for images to be pullable from registry..."
163-
163+
164164
images='${{ needs.get-managed-components.outputs.managed_images }}'
165165
read -a IMAGE_ARRAY <<< "$images"
166-
166+
167167
MAX_RETRIES=120
168168
SLEEP_INTERVAL=60
169169
retry_count=0
170-
170+
171171
for image in "${IMAGE_ARRAY[@]}"; do
172-
image_url="${DOCKER_REGISTRY}/${image}:${COMPONENT_TAG}"
172+
if [[ "$image" == *stig-fips ]]; then
173+
component_tag="${COMPONENT_TAG}-stig-fips"
174+
else
175+
component_tag="${COMPONENT_TAG}"
176+
fi
177+
178+
image_url="${DOCKER_REGISTRY}/${image}:${component_tag}"
173179
echo "Checking availability of: ${image_url}"
174180
175181
while [ $retry_count -lt $MAX_RETRIES ]; do
176-
if docker manifest inspect "${DOCKER_REGISTRY}/${image}:${COMPONENT_TAG}" > /dev/null 2>&1; then
182+
if docker manifest inspect "${image_url}" > /dev/null 2>&1; then
177183
echo "Image available: ${image_url}"
178184
break
179185
else
@@ -182,15 +188,15 @@ jobs:
182188
retry_count=$((retry_count + 1))
183189
fi
184190
done
185-
191+
186192
if [ $retry_count -eq $MAX_RETRIES ]; then
187193
echo "Failed to find image after $MAX_RETRIES attempts: ${image_url}"
188194
exit 1
189195
fi
190196
done
191-
197+
192198
echo "All images are available"
193-
199+
194200
create-release-pr:
195201
needs: [determine-versions, wait-for-images]
196202
runs-on: ubuntu-24.04
@@ -234,29 +240,31 @@ jobs:
234240
# Update Network Operator version
235241
yq -i '.NetworkOperator.version = "${{ env.APP_VERSION }}"' hack/release.yaml
236242
yq -i '.NetworkOperator.repository = "${{ env.DOCKER_REGISTRY_NETWORK_OPERATOR }}"' hack/release.yaml
237-
243+
238244
# Update components with sourceRepository to use new registry and version
239245
for component in $(yq 'keys | .[]' hack/release.yaml); do
240246
SOURCE_REPO=$(yq ".${component}.sourceRepository" hack/release.yaml)
241-
247+
242248
# Skip components without sourceRepository
243249
if [ "$SOURCE_REPO" = "null" ]; then
244250
continue
245251
fi
246-
252+
247253
# We always need to add '-stig-fips' suffix for corresponding image version
248254
# TODO: do not DOCA Driver image for now because $SOURCE_REPO is null one Network Operator will support a new version format
249255
if [[ "$component" == *StigFips ]]; then
250-
COMPONENT_TAG="${COMPONENT_TAG}-stig-fips"
251-
fi
252-
256+
component_tag="${COMPONENT_TAG}-stig-fips"
257+
else
258+
component_tag="${COMPONENT_TAG}"
259+
fi
260+
253261
echo "Updating component: $component"
254262
echo " Setting repository to: $DOCKER_REGISTRY_MANAGED_COMPONENTS"
255-
echo " Setting version to: $COMPONENT_TAG"
256-
263+
echo " Setting version to: $component_tag"
264+
257265
# Update repository and version for components with sourceRepository
258266
yq -i ".${component}.repository = \"$DOCKER_REGISTRY_MANAGED_COMPONENTS\"" hack/release.yaml
259-
yq -i ".${component}.version = \"$COMPONENT_TAG\"" hack/release.yaml
267+
yq -i ".${component}.version = \"$component_tag\"" hack/release.yaml
260268
261269
# Pull the component's helm chart
262270
CHART_LOCATION=$(yq ".${component}.chartLocation" hack/release.yaml)
@@ -296,8 +304,8 @@ jobs:
296304
297305
# Special handling for Mofed component (update registry only, not version, for all releases)
298306
echo "Updating Mofed components registry for release"
299-
yq -i '.Mofed.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
300-
yq -i '.MofedStig.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
307+
yq -i '.Mofed.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
308+
yq -i '.MofedStigFips.repository = "${{ env.DOCKER_REGISTRY_MANAGED_COMPONENTS }}"' hack/release.yaml
301309
302310
# Update chart versions
303311
yq -i '.version = "${{ env.CHART_VERSION }}"' deployment/network-operator/Chart.yaml

0 commit comments

Comments
 (0)