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