8000 chore: build SBOMs for ublue-os/main images by p5 · Pull Request #754 · ublue-os/main · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: build SBOMs for ublue-os/main images #754

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
38 changes: 38 additions & 0 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,26 @@ jobs:
sbverify --cert kernel-sign.crt vmlinuz || exit 1
sbverify --cert akmods.crt vmlinuz || exit 1

- name: Setup Syft
id: setup-syft
if: github.event_name != 'pull_request'
uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0

- name: Generate SBOM
id: generate-sbom
if: github.event_name != 'pull_request'
env:
IMAGE: ${{ env.IMAGE_NAME }}
DEFAULT_TAG: ${{ env.DEFAULT_TAG }}
SYFT_CMD: ${{ steps.setup-syft.outputs.cmd }}
run: |
sudo systemctl start podman.socket

OUTPUT_PATH="$(mktemp -d)/sbom.json"
export SYFT_PARALLELISM=$(($(nproc)*2))
sudo $SYFT_CMD ${IMAGE}:${DEFAULT_TAG} -o spdx-json=${OUTPUT_PATH}
echo "OUTPUT_PATH=${OUTPUT_PATH}" >> $GITHUB_OUTPUT

# Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR.
# https://github.com/macbre/push-to-ghcr/issues/12
- name: Lowercase Registry
Expand All @@ -233,6 +253,7 @@ jobs:
registry: ${{ steps.registry_case.outputs.lowercase }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
digestfile: /tmp/digestfile
extra-args: |
--disable-content-trust

Expand All @@ -257,6 +278,23 @@ jobs:
COSIGN_EXPERIMENTAL: false
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}

- name: Add SBOM Attestation
if: github.event_name != 'pull_request'
env:
IMAGE: ${{ steps.registry_case.outputs.lowercase }}/${{ steps.build_image.outputs.image }}
DIGESTFILE: /tmp/digestfile
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
SBOM_OUTPUT: ${{ steps.generate-sbom.outputs.OUTPUT_PATH }}
run: |
DIGEST=$(cat "${DIGESTFILE}")

cd "$(dirname "$SBOM_OUTPUT")"
cosign attest -y \
--predicate ./sbom.json \
--type spdxjson \
--key env://COSIGN_PRIVATE_KEY \
"${IMAGE}@${DIGEST}"

- name: Echo outputs
if: github.event_name != 'pull_request'
run: |
Expand Down
0