@@ -251,6 +251,11 @@ spec:
251
251
declare -a to_sign_references=()
252
252
declare -a to_sign_digests=()
253
253
254
+ # Arrays to store information for parallel processing
255
+ declare -a find_signatures_jobs=()
256
+ declare -a component_data=()
257
+
258
+ # First pass: collect all find_signatures calls and start them in parallel
254
259
for (( COMPONENTS_INDEX=0; COMPONENTS_INDEX<COMPONENTS_LENGTH; COMPONENTS_INDEX++ )); do
255
260
256
261
referenceContainerImage=$(jq -r ".components[${COMPONENTS_INDEX}].containerImage" "${SNAPSHOT_PATH}")
@@ -298,13 +303,50 @@ spec:
298
303
REGISTRY_REFERENCES+=("${registry_access_repo}")
299
304
fi
300
305
301
- for manifest_digest in $manifest_digests; do
306
+ # Store component data for later processing
307
+ component_data+=("${COMPONENTS_INDEX}|${repository}|${TAGS}|${manifest_digests}|${sourceContainerDigest}|${rh_registry_repo}|${registry_access_repo}")
302
308
309
+ # Start find_signatures jobs in parallel for manifest digests
310
+ for manifest_digest in $manifest_digests; do
311
+ echo "Starting find_signatures job for manifest digest: ${manifest_digest}"
303
312
find_signatures --pyxis-graphql-api "${PYXIS_GRAPHQL_URL}" \
304
313
--manifest_digest "${manifest_digest}" \
305
314
--repository "${repository}" \
306
- --output_file "/tmp/${manifest_digest}"
315
+ --output_file "/tmp/${manifest_digest}" &
316
+ find_signatures_jobs+=($!)
317
+ done
318
+
319
+ # Start find_signatures job for source container digest if it exists
320
+ if [ "${sourceContainerDigest}" != "" ] ; then
321
+ echo "Starting find_signatures job for source container digest: ${sourceContainerDigest}"
322
+ find_signatures --pyxis-graphql-api "${PYXIS_GRAPHQL_URL}" \
323
+ --manifest_digest "${sourceContainerDigest}" \
324
+ --repository "${repository}" \
325
+ --output_file "/tmp/${sourceContainerDigest}" &
326
+ find_signatures_jobs+=($!)
327
+ fi
328
+ done
329
+
330
+ # Wait for all find_signatures jobs to complete
331
+ echo "Waiting for ${#find_signatures_jobs[@]} find_signatures jobs to complete..."
332
+ for job in "${find_signatures_jobs[@]}"; do
333
+ wait "$job"
334
+ done
335
+ echo "All find_signatures jobs completed"
307
336
337
+ # Second pass: process the results now that all find_signatures calls are complete
338
+ for component_info in "${component_data[@]}"; do
339
+ IFS='|' read -r COMPONENTS_INDEX repository TAGS manifest_digests sourceContainerDigest \
340
+ rh_registry_repo registry_access_repo <<< "$component_info"
341
+
342
+ # Sign rh-registry-repo references (always) and registry-access-repo references
343
+ # (only if signatures for this registry are required)
344
+ REGISTRY_REFERENCES=("${rh_registry_repo}")
345
+ if grep -q "^${repository}$" "${SIGN_REGISTRY_ACCESS_FILE}"; then
346
+ REGISTRY_REFERENCES+=("${registry_access_repo}")
347
+ fi
348
+
349
+ for manifest_digest in $manifest_digests; do
308
350
# Iterate over both rh-registry-repo and registry-access-repo
309
351
for registry_reference in "${REGISTRY_REFERENCES[@]}"; do
310
352
@@ -324,12 +366,6 @@ spec:
324
366
done
325
367
326
368
if [ "${sourceContainerDigest}" != "" ] ; then
327
-
328
- find_signatures --pyxis-graphql-api "${PYXIS_GRAPHQL_URL}" \
329
- --manifest_digest "${sourceContainerDigest}" \
330
- --repository "${repository}" \
331
- --output_file "/tmp/${sourceContainerDigest}"
332
-
333
369
for registry_reference in "${REGISTRY_REFERENCES[@]}"; do
334
370
335
371
for tag in ${TAGS}; do
@@ -343,8 +379,8 @@ spec:
343
379
echo "- reference=${registry_reference}:${sourceTag}"
344
380
echo "- manifest_digest=${sourceContainerDigest}"
345
381
fi
382
+ done
346
383
done
347
- done
348
384
fi
349
385
done
350
386
0 commit comments