Skip to content

Commit

Permalink
Merge pull request #356 from crazy-max/sbom-provenance
Browse files Browse the repository at this point in the history
ci: generate sbom and provenance
  • Loading branch information
crazy-max authored Mar 24, 2024
2 parents db7ad27 + 47cfbae commit ae5dc21
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,26 @@ jobs:
uses: docker/bake-action@v4
with:
targets: artifact
provenance: mode=max
sbom: true
pull: true
set: |
*.platform=${{ matrix.platform }}
*.cache-from=type=gha,scope=artifact-${{ env.PLATFORM_PAIR }}
*.cache-to=type=gha,scope=artifact-${{ env.PLATFORM_PAIR }},mode=max
-
name: Rename provenance and sbom
working-directory: ${{ env.DESTDIR }}/artifact
run: |
binname=$(find . -name 'ftpgrab_*')
filename=$(basename "$binname" | sed -E 's/\.(tar\.gz|zip)$//')
mv "provenance.json" "${filename}.provenance.json"
mv "sbom-binary.spdx.json" "${filename}.sbom.json"
find . -name 'sbom*.json' -exec rm {} \;
-
name: List artifacts
run: |
tree -nh ${{ env.DESTDIR }}
-
name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -150,6 +165,7 @@ jobs:
uses: docker/bake-action@v4
with:
targets: release
provenance: false
-
name: GitHub Release
uses: softprops/action-gh-release@v2
Expand Down Expand Up @@ -230,6 +246,8 @@ jobs:
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-all
provenance: mode=max
sbom: true
pull: true
push: ${{ github.event_name != 'pull_request' }}
set: |
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ FROM binary-unix AS binary-darwin
FROM binary-unix AS binary-freebsd
FROM binary-unix AS binary-linux
FROM binary-$TARGETOS AS binary
# enable scanning for this stage
ARG BUILDKIT_SBOM_SCAN_STAGE=true

FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS build-artifact
RUN apk add --no-cache bash tar zip
Expand Down

0 comments on commit ae5dc21

Please sign in to comment.