Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPDX: Fix package manager label #801

Merged
merged 2 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/sbom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
pull_request:
branches: ['main']

env:
SPDX_TOOLS_VERSION: 1.1.0

jobs:
go-version-m:
name: Generate go version -m
Expand Down Expand Up @@ -75,15 +78,15 @@ jobs:

- name: Install SPDX Tools
run: |
wget https://github.com/spdx/tools-java/releases/download/v1.0.4/tools-java-1.0.4.zip
unzip tools-java-1.0.4.zip
wget https://github.com/spdx/tools-java/releases/download/v${SPDX_TOOLS_VERSION}/tools-java-${SPDX_TOOLS_VERSION}.zip
unzip tools-java-${SPDX_TOOLS_VERSION}.zip

- name: Generate and Validate
run: |
img=$(go run ./ build ./)
go run ./ deps $img --sbom=spdx | tee spdx.json

java -jar ./tools-java-1.0.4-jar-with-dependencies.jar Verify spdx.json
java -jar ./tools-java-${SPDX_TOOLS_VERSION}-jar-with-dependencies.jar Verify spdx.json

- uses: actions/upload-artifact@v3
if: ${{ always() }}
Expand All @@ -108,8 +111,8 @@ jobs:

- name: Install SPDX Tools
run: |
wget https://github.com/spdx/tools-java/releases/download/v1.0.4/tools-java-1.0.4.zip
unzip tools-java-1.0.4.zip
wget https://github.com/spdx/tools-java/releases/download/v${SPDX_TOOLS_VERSION}/tools-java-${SPDX_TOOLS_VERSION}.zip
unzip tools-java-${SPDX_TOOLS_VERSION}.zip

- name: Install Cosign
uses: sigstore/[email protected]
Expand All @@ -121,7 +124,7 @@ jobs:
img=$(go run ./ build --platform=linux/amd64,linux/arm64 ./)
cosign download sbom $img | tee spdx-multi-arch.json

java -jar ./tools-java-1.0.4-jar-with-dependencies.jar Verify spdx-multi-arch.json
java -jar ./tools-java-${SPDX_TOOLS_VERSION}-jar-with-dependencies.jar Verify spdx-multi-arch.json

- uses: actions/upload-artifact@v3
if: ${{ always() }}
Expand Down
12 changes: 6 additions & 6 deletions internal/sbom/spdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func GenerateImageSPDX(koVersion string, mod []byte, img oci.SignedImage) ([]byt
LicenseDeclared: NOASSERTION,
CopyrightText: NOASSERTION,
ExternalRefs: []ExternalRef{{
Category: "PACKAGE_MANAGER",
Category: "PACKAGE-MANAGER",
Type: "purl",
Locator: ociRef("image", imgDigest, qualifier{
key: "mediaType",
Expand Down Expand Up @@ -133,7 +133,7 @@ func GenerateImageSPDX(koVersion string, mod []byte, img oci.SignedImage) ([]byt
LicenseDeclared: NOASSERTION,
CopyrightText: NOASSERTION,
ExternalRefs: []ExternalRef{{
Category: "PACKAGE_MANAGER",
Category: "PACKAGE-MANAGER",
Type: "purl",
Locator: goRef(&bi.Main),
}},
Expand All @@ -159,7 +159,7 @@ func GenerateImageSPDX(koVersion string, mod []byte, img oci.SignedImage) ([]byt
LicenseDeclared: NOASSERTION,
CopyrightText: NOASSERTION,
ExternalRefs: []ExternalRef{{
Category: "PACKAGE_MANAGER",
Category: "PACKAGE-MANAGER",
Type: "purl",
Locator: goRef(dep),
}},
Expand Down Expand Up @@ -240,7 +240,7 @@ func GenerateIndexSPDX(koVersion string, sii oci.SignedImageIndex) ([]byte, erro
Value: indexDigest.Hex,
}},
ExternalRefs: []ExternalRef{{
Category: "PACKAGE_MANAGER",
Category: "PACKAGE-MANAGER",
Type: "purl",
Locator: ociRef("index", indexDigest, qualifier{
key: "mediaType",
Expand Down Expand Up @@ -313,7 +313,7 @@ func GenerateIndexSPDX(koVersion string, sii oci.SignedImageIndex) ([]byte, erro
LicenseDeclared: NOASSERTION,
CopyrightText: NOASSERTION,
ExternalRefs: []ExternalRef{{
Category: "PACKAGE_MANAGER",
Category: "PACKAGE-MANAGER",
Type: "purl",
Locator: ociRef("image", imageDigest, qual...),
}},
Expand Down Expand Up @@ -410,7 +410,7 @@ func addBaseImage(doc *Document, annotations map[string]string, h v1.Hash) error
LicenseDeclared: NOASSERTION,
CopyrightText: NOASSERTION,
ExternalRefs: []ExternalRef{{
Category: "PACKAGE_MANAGER",
Category: "PACKAGE-MANAGER",
Type: "purl",
Locator: ociRef("image", hash, qual...),
}},
Expand Down