Post

Split Harbor catalog verification across eight protected publication jobs

Split Harbor catalog verification across eight protected publication jobs

This push splits Harbor’s full catalog verification into up to eight sequential protected publication jobs so a large reviewed catalog no longer shares a single six-hour runner budget. Each job plans its batch from scripts/config/harbor-images.json, repeats source checks, performs authenticated pulls, records digests, and only earns a full receipt when every planned job succeeds.

Batching reviewed Harbor images across production jobs

The harbor-mirror.yml workflow now holds the writer for the entire run, including transitions between catalog parts, by setting concurrency cancel-in-progress to false. A new static-policy step plans batches using jq over the image manifest: when scope is all, it emits ranges up to eight batches; fixed scopes use one job. The Copy Reviewed Public Images job now runs with fail-fast: false, max-parallel: 1, and a matrix over batches, assigning each entry by position modulo eight so every source appears exactly once. Each job sets HARBOR_MIRROR_BATCH and fails early if the variable is missing.

Test changes and receipt materialization

scripts/ci/harbor-publish-test.py now exercises batches zero through seven with fixtures assigned by position modulo eight, asserting each batch runs skopeo copy with source auth and a directory destination, then compares summary lines to expected digests and removes the summary file. It also loads scripts/config/harbor-images.json and checks the workflow plan against manifest sources. scripts/ci/harbor-publish.sh validates the batch value, materializes expected-sources with a jq filter selecting entries whose key modulo eight equals the batch, writes verified sources during the mirror loop, and compares the two files with cmp. These are test and script changes; they are not evidence that a mirror run has completed.

Validation gates and policy updates

policy/workflows.rego now includes matrix.batch in the Harbor publication error name so failures identify the failed part. openwiki/operations/validation-gates.md states the full workflow runs up to eight serial production jobs and requires success from the complete matrix before the dispatch can authorize a consumer. docs/harbor-image-mirroring.md explains that Re-run failed jobs retries a failed part at the same dispatch revision, while input changes require dispatching from current main; a revert restores the single-job publisher.

Platform engineering transfer

A platform team can reuse this technique for any large image catalog: divide reviewed sources into N serial jobs by index modulo N, give each job a bounded runner budget, require pre-flight source verification and per-job digest receipts, and make the full receipt conditional on every part succeeding. Holding the writer across catalog transitions prevents normal mirrors from racing with partial publication state.

This post is licensed under CC BY 4.0 by the author.