Skip to content

Commit d7c6aed

Browse files
authored
Merge branch 'konflux-ci:development' into auto-readme
2 parents 17f8682 + f7724b5 commit d7c6aed

5 files changed

Lines changed: 16 additions & 11 deletions

File tree

tasks/internal/filter-already-released-advisory-images-task/filter-already-released-advisory-images-task.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
- name: internalRequestTaskRunName
3333
description: The name of the InternalRequest TaskRun
3434
- name: unreleased_components
35-
description: List of components that still need to be released
35+
description: List of components that still need to be released encoded as a gzipped base64 string
3636
steps:
3737
- name: filter-images
3838
image: quay.io/konflux-ci/release-service-utils:0b2f257d7a5c2a881c36c23f8ae3cd5e89db593a
@@ -118,7 +118,7 @@ spec:
118118
119119
if [[ -z "$EXISTING_ADVISORIES" ]]; then
120120
echo "No existing advisories found. No components have been released yet."
121-
UNRELEASED_COMPONENTS=$(jq -c '[.[].name]' <<< "$CONTENT_IMAGES")
121+
UNRELEASED_COMPONENTS=$(jq -c '[.[].name]' <<< "$CONTENT_IMAGES" | gzip -c | base64 -w 0)
122122
echo -n "$UNRELEASED_COMPONENTS" > "$(results.unreleased_components.path)"
123123
echo -n "Success" > "$(results.result.path)"
124124
exit 0
@@ -144,7 +144,7 @@ spec:
144144
# If after filtering, no images are left, then we can exit early
145145
if jq -e 'length == 0' <<< "$CONTENT_IMAGES" >/dev/null; then
146146
echo "All images in the snapshot have already been released in advisories. Stopping pipeline."
147-
echo -n "[]" > "$(results.unreleased_components.path)"
147+
echo -n "[]" | gzip -c | base64 -w 0 > "$(results.unreleased_components.path)"
148148
echo -n "Success" > "$(results.result.path)"
149149
exit 0
150150
fi
@@ -156,6 +156,6 @@ spec:
156156
echo "Remaining unpublished images: $CONTENT_IMAGES"
157157
158158
# Output the list of component names that still need to be released
159-
UNRELEASED_COMPONENTS=$(jq -c '[.[].name]' <<< "$CONTENT_IMAGES")
159+
UNRELEASED_COMPONENTS=$(jq -c '[.[].name]' <<< "$CONTENT_IMAGES" | gzip -c | base64 -w 0)
160160
echo -n "$UNRELEASED_COMPONENTS" > "$(results.unreleased_components.path)"
161161
echo -n "Success" > "$(results.result.path)"

tasks/internal/filter-already-released-advisory-images-task/tests/test-filter-already-released-advisory-images.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ spec:
5151
fi
5252
5353
# Verify unreleased components list
54-
UNRELEASED_COUNT=$(jq 'length' <<< '$(params.unreleased_components)')
54+
UNRELEASED_COMPONENTS=$(base64 -d <<< "$(params.unreleased_components)" | gunzip)
55+
UNRELEASED_COUNT=$(jq 'length' <<< "$UNRELEASED_COMPONENTS")
5556
if [[ "$UNRELEASED_COUNT" -ne 1 ]]; then
5657
echo "Expected 1 unreleased component, but found $UNRELEASED_COUNT"
5758
exit 1
5859
fi
5960
60-
UNRELEASED_NAME=$(jq -r '.[0]' <<< '$(params.unreleased_components)')
61+
UNRELEASED_NAME=$(jq -r '.[0]' <<< "$UNRELEASED_COMPONENTS")
6162
if [[ "$UNRELEASED_NAME" != "new-component" ]]; then
6263
echo "Unexpected unreleased component name: $UNRELEASED_NAME"
6364
exit 1

tasks/internal/filter-already-released-advisory-images-task/tests/test-filter-no-advisory-directory.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ spec:
4747
[[ "$(params.result)" == "Success" ]]
4848
4949
# Verify all components are marked as unreleased
50-
UNRELEASED_COUNT=$(jq 'length' <<< '$(params.unreleased_components)')
50+
UNRELEASED_COMPONENTS=$(base64 -d <<< "$(params.unreleased_components)" | gunzip)
51+
UNRELEASED_COUNT=$(jq 'length' <<< "$UNRELEASED_COMPONENTS")
5152
if [[ "$UNRELEASED_COUNT" -ne 1 ]]; then
5253
echo "Expected 1 unreleased component, got $UNRELEASED_COUNT"
5354
exit 1
5455
fi
5556
56-
UNRELEASED_NAME=$(jq -r '.[0]' <<< '$(params.unreleased_components)')
57+
UNRELEASED_NAME=$(jq -r '.[0]' <<< "$UNRELEASED_COMPONENTS")
5758
if [[ "$UNRELEASED_NAME" != "test-component" ]]; then
5859
echo "Unexpected unreleased component name: $UNRELEASED_NAME"
5960
exit 1

tasks/managed/filter-already-released-advisory-images/filter-already-released-advisory-images.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,13 +262,15 @@ spec:
262262
echo "Image filtering successful"
263263
264264
# Get the unreleased components list
265-
UNRELEASED_COMPONENTS=$(echo "$results" | jq -r '.unreleased_components // "[]"')
266-
if [ -z "$UNRELEASED_COMPONENTS" ]; then
265+
UNRELEASED_COMPONENTS_RAW=$(echo "$results" | jq -r '.unreleased_components // ""')
266+
if [ -z "$UNRELEASED_COMPONENTS_RAW" ]; then
267267
echo "No unreleased components list found in results. Results:"
268268
echo "$results"
269269
exit 1
270270
fi
271271
272+
UNRELEASED_COMPONENTS=$(echo "$UNRELEASED_COMPONENTS_RAW" | base64 -d | gunzip)
273+
272274
# Filter the original snapshot using the unreleased components list
273275
FILTERED_SNAPSHOT=$(jq --argjson unreleased "$UNRELEASED_COMPONENTS" '
274276
.components = (

tasks/managed/filter-already-released-advisory-images/tests/mocks.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ function kubectl() {
77
# The IR won't actually be acted upon, so mock it to return Success as the task wants
88
if [[ "$*" == "get internalrequest "*"-o=jsonpath={.status.results}" ]]
99
then
10+
UNRELEASED=$(echo -n '["new-component"]' | gzip -c | base64 -w 0)
1011
echo '{
1112
"result": "Success",
12-
"unreleased_components": ["new-component"],
13+
"unreleased_components": "'"$UNRELEASED"'",
1314
"internalRequestPipelineRunName": "test-pipeline-run",
1415
"internalRequestTaskRunName": "test-task-run"
1516
}'

0 commit comments

Comments
 (0)