fix: fix race condition in oci_pull where bazel can write platform manifest contents to the cache entry for image index manifest #596
+30
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I captured this going wrong with traces in our internal repository.
Two repo rule run in parallel
A. debian_golden_linux_amd64
B. debian_golden_linux_arm64_v8
Events in from A. debian_golden_linux_amd64:
manifest, size, digest = downloader.download_manifest(rctx.attr.identifier, "manifest.json")
traces
manifest, size, digest = downloader.download_manifest(matching_manifest["digest"], "manifest.json")
traces
downloader.download_blob(manifest["config"]["digest"], config_output_path)
traces
Events in B. debian_golden_linux_arm64_v8:
manifest, size, digest = downloader.download_manifest(rctx.attr.identifier, "manifest.json")
traces
downloader.download_blob(manifest["config"]["digest"], config_output_path)
:traces
Failure observed
The above events lead to a failures in
debian_golden_linux_arm64_v8
repo rule atutil.validate_image_platform(rctx, config)
since the blob is for the wrong platform: