@@ -97,84 +97,14 @@ docker push 'oisupport/staging-windows-amd64:9b405cfa5b88ba65121aabdb95ae90fd2e1
97
97
98
98
# </pull>
99
99
# <build>
100
- export BASHBREW_CACHE=" ${BASHBREW_CACHE:- ${XDG_CACHE_HOME:- $HOME / .cache} / bashbrew} "
101
- gitCache=" $BASHBREW_CACHE /git"
102
- git init --bare " $gitCache "
103
- _git () { git -C " $gitCache " " $@ " ; }
104
- _git config gc.auto 0
105
- _commit () { _git rev-parse ' d0b7d566eb4f1fa9933984e6fc04ab11f08f4592^{commit}' ; }
106
- if ! _commit & > /dev/null; then _git fetch ' https://github.com/docker-library/busybox.git' ' d0b7d566eb4f1fa9933984e6fc04ab11f08f4592:' || _git fetch ' refs/heads/dist-amd64:' ; fi
107
- _commit
108
- mkdir temp
109
- _git archive --format=tar ' d0b7d566eb4f1fa9933984e6fc04ab11f08f4592:latest/glibc/amd64/' | tar -xvC temp
110
- jq -s '
111
- if length != 1 then
112
- error("unexpected ' \' ' oci-layout' \' ' document count: " + length)
113
- else .[0] end
114
- | if .imageLayoutVersion != "1.0.0" then
115
- error("unsupported imageLayoutVersion: " + .imageLayoutVersion)
116
- else . end
117
- ' temp/oci-layout > /dev/null
118
- jq -s '
119
- if length != 1 then
120
- error("unexpected ' \' ' index.json' \' ' document count: " + length)
121
- else .[0] end
122
- | if .schemaVersion != 2 then
123
- error("unsupported schemaVersion: " + .schemaVersion)
124
- else . end
125
- | if .manifests | length != 1 then
126
- error("expected only one manifests entry, not " + (.manifests | length))
127
- else . end
128
- | .manifests[0] |= (
129
- if .mediaType != "application/vnd.oci.image.manifest.v1+json" then
130
- error("unsupported descriptor mediaType: " + .mediaType)
131
- else . end
132
- | if .size < 0 then
133
- error("invalid descriptor size: " + .size)
134
- else . end
135
- | del(.annotations, .urls)
136
- | .annotations = {"org.opencontainers.image.source":"https://github.com/docker-library/busybox.git","org.opencontainers.image.revision":"d0b7d566eb4f1fa9933984e6fc04ab11f08f4592","org.opencontainers.image.created":"2024-02-28T00:44:18Z","org.opencontainers.image.version":"1.36.1","org.opencontainers.image.url":"https://hub.docker.com/_/busybox","com.docker.official-images.bashbrew.arch":"amd64","org.opencontainers.image.base.name":"scratch"}
137
- )
138
- ' temp/index.json > temp/index.json.new
139
- mv temp/index.json.new temp/index.json
100
+ build='{"buildId":"191402ad0feacf03daf9d52a492207e73ef08b0bd17265043aea13aa27e2bb3f","build":{"img":"oisupport/staging-amd64:191402ad0feacf03daf9d52a492207e73ef08b0bd17265043aea13aa27e2bb3f","resolved":{"schemaVersion":2,"mediaType":"application/vnd.oci.image.index.v1+json","manifests":[{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:4be429a5fbb2e71ae7958bfa558bc637cf3a61baf40a708cb8fff532b39e52d0","size":610,"annotations":{"com.docker.official-images.bashbrew.arch":"amd64","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2024-02-28T00:44:18Z","org.opencontainers.image.ref.name":"oisupport/staging-amd64:191402ad0feacf03daf9d52a492207e73ef08b0bd17265043aea13aa27e2bb3f@sha256:4be429a5fbb2e71ae7958bfa558bc637cf3a61baf40a708cb8fff532b39e52d0","org.opencontainers.image.revision":"d0b7d566eb4f1fa9933984e6fc04ab11f08f4592","org.opencontainers.image.source":"https://github.com/docker-library/busybox.git","org.opencontainers.image.url":"https://hub.docker.com/_/busybox","org.opencontainers.image.version":"1.36.1-glibc"},"platform":{"architecture":"amd64","os":"linux"}}],"annotations":{"org.opencontainers.image.ref.name":"oisupport/staging-amd64:191402ad0feacf03daf9d52a492207e73ef08b0bd17265043aea13aa27e2bb3f@sha256:70a227928672dffb7d24880bad1a705b527fab650f7503c191e48a209c4a0d10"}},"sourceId":"df39fa95e66c7e19e56af0f9dfb8b79b15a0422a9b44eb0f16274d3f1f8939a2","arch":"amd64","parents":{},"resolvedParents":{}},"source":{"sourceId":"df39fa95e66c7e19e56af0f9dfb8b79b15a0422a9b44eb0f16274d3f1f8939a2","reproducibleGitChecksum":"17e76ce3a5b47357c5724738db231ed2477c94d43df69ce34ae0871c99f7de78","entries":[{"GitRepo":"https://github.com/docker-library/busybox.git","GitFetch":"refs/heads/dist-amd64","GitCommit":"d0b7d566eb4f1fa9933984e6fc04ab11f08f4592","Directory":"latest/glibc/amd64","File":"index.json","Builder":"oci-import","SOURCE_DATE_EPOCH":1709081058}],"arches":{"amd64":{"tags":["busybox:1.36.1","busybox:1.36","busybox:1","busybox:stable","busybox:latest","busybox:1.36.1-glibc","busybox:1.36-glibc","busybox:1-glibc","busybox:stable-glibc","busybox:glibc"],"archTags":["amd64/busybox:1.36.1","amd64/busybox:1.36","amd64/busybox:1","amd64/busybox:stable","amd64/busybox:latest","amd64/busybox:1.36.1-glibc","amd64/busybox:1.36-glibc","amd64/busybox:1-glibc","amd64/busybox:stable-glibc","amd64/busybox:glibc"],"froms":["scratch"],"lastStageFrom":"scratch","platformString":"linux/amd64","platform":{"architecture":"amd64","os":"linux"},"parents":{"scratch":{"sourceId":null,"pin":null}}}}}}'
101
+ " $BASHBREW_META_SCRIPTS /helpers/oci-import.sh" <<< " $build" temp
140
102
# SBOM
141
- originalImageManifest=" $( jq -r ' .manifests[0].digest' temp/index.json) "
142
- SOURCE_DATE_EPOCH=1709081058 \
143
- docker buildx build --progress=plain \
144
- --load=false \
145
- --provenance=false \
146
- --build-arg BUILDKIT_DOCKERFILE_CHECK=skip=all \
147
- --sbom=generator=" $BASHBREW_BUILDKIT_SBOM_GENERATOR " \
148
- --output ' type=oci,tar=false,dest=sbom' \
149
- --platform ' linux/amd64' \
150
- --build-context " fake=oci-layout://$PWD /temp@$originalImageManifest " \
151
- - <<< ' FROM fake'
152
- sbomIndex=" $( jq -r ' .manifests[0].digest' sbom/index.json) "
153
- shell=" $( jq -r --arg originalImageManifest " $originalImageManifest " '
154
- first(
155
- .manifests[]
156
- | select(.annotations["vnd.docker.reference.type"] == "attestation-manifest")
157
- ) as $attDesc
158
- | @sh "sbomManifest=\($attDesc.digest)",
159
- @sh "sbomManifestDesc=\(
160
- $attDesc
161
- | .annotations["vnd.docker.reference.digest"] = $originalImageManifest
162
- | tojson
163
- )"
164
- ' " sbom/blobs/${sbomIndex/:// } " ) "
165
- eval " $shell "
166
- shell=" $( jq -r '
167
- "copyBlobs=( \([ .config.digest, .layers[].digest | @sh ] | join(" ")) )"
168
- ' " sbom/blobs/${sbomManifest/:// } " ) "
169
- eval " $shell "
170
- copyBlobs+=( " $sbomManifest " )
171
- for blob in " ${copyBlobs[@]} " ; do
172
- cp " sbom/blobs/${blob/:// } " " temp/blobs/${blob/:// } "
173
- done
174
- jq -r --argjson sbomManifestDesc " $sbomManifestDesc " ' .manifests += [ $sbomManifestDesc ]' temp/index.json > temp/index.json.new
175
- mv temp/index.json.new temp/index.json
103
+ mv temp temp.orig
104
+ " $BASHBREW_META_SCRIPTS /helpers/oci-sbom.sh" <<< " $build" temp.orig temp
105
+ rm -rf temp.orig
176
106
# </build>
177
107
# <push>
178
- crane push --index temp ' oisupport/staging-amd64:191402ad0feacf03daf9d52a492207e73ef08b0bd17265043aea13aa27e2bb3f'
108
+ crane push temp ' oisupport/staging-amd64:191402ad0feacf03daf9d52a492207e73ef08b0bd17265043aea13aa27e2bb3f'
179
109
rm -rf temp
180
110
# </push>
0 commit comments