Skip to content

Commit 671b3ba

Browse files
authored
Merge pull request #73 from LaurentGoderre/sbom-arch-check
Move arch check from SBOM generation to this script
2 parents f5b18c8 + 19cda96 commit 671b3ba

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

doi.jq

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,20 @@ def _sbom_subset:
155155
# input: "build" object (with "buildId" top level key)
156156
# output: boolean
157157
def build_should_sbom:
158-
.source.arches[.build.arch].tags
159-
| map(split(":")[0])
160-
| unique
161-
| _sbom_subset as $subset
162-
| any(.[];
163-
. as $i
164-
| $subset
165-
| index($i)
158+
# see "bashbrew remote arches docker/scout-sbom-indexer:1" (we need the SBOM scanner to be runnable on the host architecture)
159+
# bashbrew remote arches --json docker/scout-sbom-indexer:1 | jq '.arches | keys_unsorted' -c
160+
(
161+
.build.arch as $arch | ["amd64","arm32v5","arm32v7","arm64v8","i386","ppc64le","riscv64","s390x"] | index($arch)
162+
) and (
163+
.source.arches[.build.arch].tags
164+
| map(split(":")[0])
165+
| unique
166+
| _sbom_subset as $subset
167+
| any(.[];
168+
. as $i
169+
| $subset
170+
| index($i)
171+
)
166172
)
167173
;
168174

meta.jq

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,7 @@ def build_command:
143143
"docker buildx build --progress=plain",
144144
"--provenance=mode=max",
145145
if build_should_sbom then
146-
# see "bashbrew remote arches docker/scout-sbom-indexer:1" (we need the SBOM scanner to be runnable on the host architecture)
147-
# bashbrew remote arches --json docker/scout-sbom-indexer:1 | jq '.arches | keys_unsorted' -c
148-
if .build.arch as $arch | ["amd64","arm32v5","arm32v7","arm64v8","i386","ppc64le","riscv64","s390x"] | index($arch) then
149-
# TODO this needs to be based on the *host* architecture, not the *target* architecture (amd64 vs i386)
150-
"--sbom=generator=\"$BASHBREW_BUILDKIT_SBOM_GENERATOR\""
151-
else empty end
146+
"--sbom=generator=\"$BASHBREW_BUILDKIT_SBOM_GENERATOR\""
152147
else empty end,
153148
"--output " + (
154149
[

0 commit comments

Comments
 (0)