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

[DPE-2137] Add SBOM generation #31

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ on:
- 8.0-22.04

jobs:
build:
uses: ./.github/workflows/build.yaml
sbom:
uses: ./.github/workflows/sbom.yaml
publish:
needs: build
needs: sbom
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/sbom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Generate SBOM
on:
workflow_call:

jobs:
build:
uses: ./.github/workflows/build.yaml
sbom:
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dragomirp after some internal discussions, please replace here "main" with "v0.85.0", it should be safe enough to merge it AS IS, until we have a final SBOM Canonical vision. Tnx!

Suggested change
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
curl -sSfL https://raw.githubusercontent.com/anchore/syft/v0.85.0/install.sh | sh -s -- -b /usr/local/bin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taurus-forever That doesn't address security concerns—the tag can be moved. Suggest pinning to a commit hash instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carlcsaposs-canonical I intend to move this to check the image from the registry, so it wouldn't matter if the artefact is potentially changed, but I can't promise it would be this pulse.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is that main and v0.85.0 are essentially the same from a security perspective—in the short term, I think we should either stay with main or move to a commit hash

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Running syft at the end against the registry instead of the artefact would address this, since at that point the artefact is already published.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I can't promise it would be this pulse

For the commit hash, I'm only referring to short-term (i.e. this PR)

- name: Set tag
run: |
version=$(yq '(.version|split("-"))[0]' rockcraft.yaml)
base=$(yq '(.base|split(":"))[1]' rockcraft.yaml)
echo "tag=${version}-${base}_edge" >> "$GITHUB_ENV"
- uses: actions/download-artifact@v3
with:
name: charmed-mysql-rock
- name: Create SBOM
run: syft charmed-mysql_${{env.tag}}_amd64.rock -o spdx-json=charmed-mysql_${{env.tag}}_amd64.rock.spdx.json
- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
path: "charmed-mysql_${{env.tag}}_amd64.rock.spdx.json"
name: charmed-mysql_${{env.tag}}_amd64.rock.spdx.json
Loading