@@ -132,59 +132,52 @@ spec:
132132 IMAGE_DIGESTS=$(jq -c --argjson i "$i" '.components[$i].image_digests // []' "$RESULTS_FILE")
133133 COMPLETION_TIME=$(jq -r --argjson i "$i" '.components[$i].completion_time // empty' "$RESULTS_FILE")
134134
135- # Validate completion_time is present
136- if [[ -z "${COMPLETION_TIME}" || "${COMPLETION_TIME}" == "null" ]]; then
137- echo "ERROR: Component $i missing completion_time in results file"
138- exit 1
139- fi
135+ # create pyxis entry for the component for tags in separated
136+ for TARGET in $TARGETINDEX $TARGETINDEX_TS; do
137+ REPOSITORY=${TARGET%:*}
140138
141- REPOSITORY=${TARGETINDEX%:*}
139+ TAG=${TARGET#*:}
140+ TAGS=("${TAG}")
141+ JSON_TAGS=$(jq -n -c '$ARGS.positional' --args -- "${TAGS[@]}")
142142
143- TAG=${TARGETINDEX#*:}
144- TAGS=("${TAG}")
145- if [[ "${TARGETINDEX}" != "${TARGETINDEX_TS}" ]]; then
146- TAG=${TARGETINDEX_TS#*:}
147- TAGS+=("${TAG}")
148- fi
149- JSON_TAGS=$(jq -n -c '$ARGS.positional' --args -- "${TAGS[@]}")
143+ # Translate target_index to get rh-registry-repo and registry-access-repo
144+ TRANSLATED=$(translate-delivery-repo "$TARGETINDEX")
145+ RH_REGISTRY_REPO=$(jq -r '.[] | select(.repo=="redhat.io") | .url' <<< "$TRANSLATED" \
146+ | cut -d':' -f1)
147+ REGISTRY_ACCESS_REPO=$(jq -r '.[] | select(.repo=="access.redhat.com") | .url' \
148+ <<< "$TRANSLATED" | cut -d':' -f1)
150149
151- # Translate target_index to get rh-registry-repo and registry-access-repo
152- TRANSLATED=$(translate-delivery-repo "$TARGETINDEX")
153- RH_REGISTRY_REPO=$(jq -r '.[] | select(.repo=="redhat.io") | .url' <<< "$TRANSLATED" \
154- | cut -d':' -f1)
155- REGISTRY_ACCESS_REPO=$(jq -r '.[] | select(.repo=="access.redhat.com") | .url' \
156- <<< "$TRANSLATED" | cut -d':' -f1)
150+ # Build repository object with translated fields
151+ REPO_OBJECT=$(jq -n \
152+ --arg url "${REPOSITORY}" \
153+ --argjson tags "${JSON_TAGS}" \
154+ --arg rh_registry_repo "${RH_REGISTRY_REPO}" \
155+ --arg registry_access_repo "${REGISTRY_ACCESS_REPO}" \
156+ '{
157+ "url": $url,
158+ "tags": $tags
159+ } + (if $rh_registry_repo != "" then {"rh-registry-repo": $rh_registry_repo} else {} end)
160+ + (if $registry_access_repo != "" then {"registry-access-repo": $registry_access_repo} else {} end)'
161+ )
157162
158- # Build repository object with translated fields
159- REPO_OBJECT=$(jq -n \
160- --arg url "${REPOSITORY}" \
161- --argjson tags "${JSON_TAGS}" \
162- --arg rh_registry_repo "${RH_REGISTRY_REPO}" \
163- --arg registry_access_repo "${REGISTRY_ACCESS_REPO}" \
164- '{
165- "url": $url,
166- "tags": $tags
167- } + (if $rh_registry_repo != "" then {"rh-registry-repo": $rh_registry_repo} else {} end)
168- + (if $registry_access_repo != "" then {"registry-access-repo": $registry_access_repo} else {} end)'
169- )
170-
171- COMPONENT=$(jq -n \
172- --arg image "${SOURCEINDEX}" \
173- --arg repository "${REPOSITORY}" \
174- --argjson tags "${JSON_TAGS}" \
175- --argjson image_digests "${IMAGE_DIGESTS}" \
176- --argjson repo_object "${REPO_OBJECT}" \
177- '{
178- "containerImage": $image,
179- "repository": $repository,
180- "repositories": [$repo_object],
181- "tags": $tags,
182- "imageDigests": $image_digests
183- }'
184- )
185- export COMPONENT
186- yq -i '.components += env(COMPONENT) ' "$SNAPSHOT_FILE"
187- done
163+ COMPONENT=$(jq -n \
164+ --arg image "${SOURCEINDEX}" \
165+ --arg repository "${REPOSITORY}" \
166+ --argjson tags "${JSON_TAGS}" \
167+ --argjson image_digests "${IMAGE_DIGESTS}" \
168+ --argjson repo_object "${REPO_OBJECT}" \
169+ '{
170+ "containerImage": $image,
171+ "repository": $repository,
172+ "repositories": [$repo_object],
173+ "tags": $tags,
174+ "imageDigests": $image_digests
175+ }'
176+ )
177+ export COMPONENT
178+ yq -i '.components += env(COMPONENT) ' "$SNAPSHOT_FILE"
179+ done # end taget index loop
180+ done # end components loop
188181 echo -n "index_image_snapshot.json" > "$(results.indexImageSnapshot.path)"
189182 - name : create-trusted-artifact
190183 computeResources :
0 commit comments