Skip to content

Commit 0c6dc29

Browse files
committed
feat(RELEASE-2092): get snapshot from kubearchive if deleted
The catalog tasks mostly use the get-resource script in release-utils-repo to get Kubernetes resources. For snapshots, this script has been modified to fallback to kubearchive if the resource had been deleted [1]. This approach doesn't work if the get-resource script isn't used to get the snapshot. This commit modifies the one instance where this happens to use the get-resource script, ensuring that the kubearchive fallback is used. [1] konflux-ci/release-service-utils#657 Assisted-by: Cursor Signed-off-by: Lubomir Gallovic <lgallovi@redhat.com>
1 parent 5252a39 commit 0c6dc29

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

tasks/managed/collect-data/collect-data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ spec:
148148
runAsUser: 1001
149149
steps:
150150
- name: collect-data
151-
image: quay.io/konflux-ci/release-service-utils@sha256:5546fa78d3c88d7b6a2e8cff8902f7757f00541d0bbaf113b9f293133894afa3
151+
image: quay.io/konflux-ci/release-service-utils@sha256:48af95ad820774a40d58f57c836f5cdc09f8e70b4d46da304e413e536da752e9
152152
computeResources:
153153
limits:
154154
memory: 64Mi

tasks/managed/reduce-snapshot/reduce-snapshot.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ spec:
131131
value: $(params.SINGLE_COMPONENT_CUSTOM_RESOURCE)
132132
- name: CUSTOM_RESOURCE_NAMESPACE
133133
value: $(params.SINGLE_COMPONENT_CUSTOM_RESOURCE_NS)
134-
image: quay.io/konflux-ci/release-service-utils@sha256:5546fa78d3c88d7b6a2e8cff8902f7757f00541d0bbaf113b9f293133894afa3
134+
image: quay.io/konflux-ci/release-service-utils@sha256:48af95ad820774a40d58f57c836f5cdc09f8e70b4d46da304e413e536da752e9
135135
computeResources:
136136
limits:
137137
memory: 128Mi
@@ -148,13 +148,17 @@ spec:
148148
exit 0
149149
fi
150150
151-
CR_NAMESPACE_ARG=
152-
if [ "${CUSTOM_RESOURCE_NAMESPACE}" != "" ]; then
153-
CR_NAMESPACE_ARG="-n ${CUSTOM_RESOURCE_NAMESPACE}"
151+
# Split CUSTOM_RESOURCE (type/name) into resource type and name
152+
CR_TYPE="${CUSTOM_RESOURCE%%/*}"
153+
CR_NAME="${CUSTOM_RESOURCE#*/}"
154+
155+
# Use provided namespace or infer from the pod's current namespace
156+
if [ -z "${CUSTOM_RESOURCE_NAMESPACE}" ]; then
157+
CUSTOM_RESOURCE_NAMESPACE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
154158
fi
155159
156-
LABELS=$(kubectl get "$CUSTOM_RESOURCE" ${CR_NAMESPACE_ARG:+$CR_NAMESPACE_ARG} -ojson \
157-
| jq -r '.metadata.labels')
160+
LABELS=$(get-resource "$CR_TYPE" "${CUSTOM_RESOURCE_NAMESPACE}/${CR_NAME}" \
161+
"{.metadata.labels}")
158162
SNAPSHOT_CREATION_TYPE=$(jq -r '."test.appstudio.openshift.io/type" // ""' <<< "${LABELS}")
159163
SNAPSHOT_CREATION_COMPONENT=$(jq -r '."appstudio.openshift.io/component" // ""' <<< "${LABELS}")
160164

0 commit comments

Comments
 (0)