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

Generate and upload SBOM #12

Merged
merged 2 commits into from Jun 26, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Expand Up @@ -6,10 +6,10 @@ on:
workflow_dispatch:

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
permissions:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/sbom.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should merge this in the build workflow?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say, we will have to merge it as shared data-platform-workflow one day.
Meanwhile, I would prefer to keep it as separate workflow to indicate PoC availability here.

@@ -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
- 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: postgresql-rock
- name: Create SBOM
run: syft charmed-postgresql_${{env.tag}}_amd64.rock -o spdx-json=charmed-postgresql_${{env.tag}}_amd64.rock.spdx.json
- name: Upload SBOM
uses: actions/upload-artifact@v3
with:
path: "charmed-postgresql_${{env.tag}}_amd64.rock.spdx.json"
name: charmed-postgresql_${{env.tag}}_amd64.rock.spdx.json