Skip to content

Commit 468ffc5

Browse files
authored
Merge pull request #43 from infosiftr/defense-in-depth
Add more "defense in depth" to collecting manifests for deploy
2 parents c8b6c1a + 3dcc133 commit 468ffc5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

deploy.jq

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ def tagged_manifests(builds_selector; tags_extractor):
88
$i
99
| tags_extractor
1010
| ..|strings # no matter what "tags_extractor" gives us, this will flatten us to a stream of strings
11-
] += $i.build.resolved.manifests
11+
] += [
12+
# as an extra protection against cross-architecture "bleeding" ("riscv64" infra pushing "amd64" images, for example), filter the list of manifests to those whose architecture matches the architecture it is supposed to be for
13+
# to be explicitly clear, this filtering is *also* done as part of our "builds.json" generation, so this is an added layer of best-effort protection that will be especially important to preserve and/or replicate if/when we solve the "not built yet so include the previous contents of the tag" portion of the problem at this layer instead of in the currently-separate put-shared process
14+
$i.build.resolved.manifests[]
15+
| select(.annotations["com.docker.official-images.bashbrew.arch"] // "" == $i.build.arch) # this assumes "registry.SynthesizeIndex" created this list of manifests (because it sets this annotation), but it would be reasonable for us to reimplement that conversion of "OCI platform object" to "bashbrew architecture" in pure jq if it was prudent or necessary to do so
16+
]
1217
)
1318
;
1419
def arch_tagged_manifests($arch):

0 commit comments

Comments
 (0)