File tree 2 files changed +16
-4
lines changed
build-maven-zip-oci-ta/0.1 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ spec:
160
160
161
161
# Save the SBOM produced by Cachi2 so it can be merged into the final SBOM later
162
162
if [ -f "/var/workdir/cachi2/output/bom.json" ]; then
163
- cp -vf "/var/workdir/cachi2/output/bom.json" ./sbom-cyclonedx .json
163
+ cp -vf "/var/workdir/cachi2/output/bom.json" ./sbom.json
164
164
else
165
165
echo "The SBOM file for fetched artifacts is not found!"
166
166
exit 1
@@ -193,7 +193,13 @@ spec:
193
193
update-ca-trust
194
194
fi
195
195
196
- cosign attach sbom --sbom sbom-cyclonedx.json --type cyclonedx "$IMAGE"
196
+ if jq -e '.bomFormat == "CycloneDX"' <sbom.json >/dev/null; then
197
+ sbom_type=cyclonedx
198
+ else
199
+ sbom_type=spdx
200
+ fi
201
+
202
+ cosign attach sbom --sbom sbom.json --type "$sbom_type" "$IMAGE"
197
203
198
204
# Remove tag from IMAGE while allowing registry to contain a port number.
199
205
sbom_repo="${IMAGE%:*}"
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ spec:
133
133
134
134
# Save the SBOM produced by Cachi2 so it can be merged into the final SBOM later
135
135
if [ -f "$(workspaces.source.path)/cachi2/output/bom.json" ]; then
136
- cp -vf "$(workspaces.source.path)/cachi2/output/bom.json" ./sbom-cyclonedx .json
136
+ cp -vf "$(workspaces.source.path)/cachi2/output/bom.json" ./sbom.json
137
137
else
138
138
echo "The SBOM file for fetched artifacts is not found!"
139
139
exit 1
@@ -159,7 +159,13 @@ spec:
159
159
update-ca-trust
160
160
fi
161
161
162
- cosign attach sbom --sbom sbom-cyclonedx.json --type cyclonedx "$IMAGE"
162
+ if jq -e '.bomFormat == "CycloneDX"' < sbom.json >/dev/null; then
163
+ sbom_type=cyclonedx
164
+ else
165
+ sbom_type=spdx
166
+ fi
167
+
168
+ cosign attach sbom --sbom sbom.json --type "$sbom_type" "$IMAGE"
163
169
164
170
# Remove tag from IMAGE while allowing registry to contain a port number.
165
171
sbom_repo="${IMAGE%:*}"
You can’t perform that action at this time.
0 commit comments