Skip to content

Commit 8a0b92d

Browse files
authored
Merge pull request #1094 from fluxcd/sbom
Publish a Software Bill of Materials (SBOM)
2 parents 617f416 + 2f0d34a commit 8a0b92d

File tree

7 files changed

+61
-44
lines changed

7 files changed

+61
-44
lines changed

.github/workflows/build.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- main
1111

12+
permissions:
13+
contents: read # for actions/checkout to fetch code
14+
1215
jobs:
1316
container:
1417
runs-on: ubuntu-latest

.github/workflows/e2e.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- main
1111

12+
permissions:
13+
contents: read # for actions/checkout to fetch code
14+
1215
jobs:
1316
kind:
1417
runs-on: ubuntu-latest

.github/workflows/helm.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: helm
33
on:
44
workflow_dispatch:
55

6+
permissions:
7+
contents: write # needed to push chart
8+
69
jobs:
710
build-push:
811
runs-on: ubuntu-latest

.github/workflows/push-ld.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: push-ld
22
on:
33
workflow_dispatch:
44

5+
permissions:
6+
contents: write # needed to write releases
7+
packages: write # needed for ghcr access
8+
59
jobs:
610
build-push:
711
runs-on: ubuntu-latest
@@ -15,13 +19,9 @@ jobs:
1519
echo ::set-output name=VERSION::${VERSION}
1620
- name: Setup QEMU
1721
uses: docker/setup-qemu-action@v1
18-
with:
19-
platforms: all
2022
- name: Setup Docker Buildx
2123
id: buildx
2224
uses: docker/setup-buildx-action@v1
23-
with:
24-
buildkitd-flags: "--debug"
2525
- name: Login to GitHub Container Registry
2626
uses: docker/login-action@v1
2727
with:

.github/workflows/release.yml

+28-27
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ on:
44
tags:
55
- 'v*'
66

7+
permissions:
8+
contents: write # needed to write releases
9+
id-token: write # needed for keyless signing
10+
packages: write # needed for ghcr access
11+
12+
env:
13+
IMAGE: "ghcr.io/fluxcd/${{ github.event.repository.name }}"
14+
715
jobs:
816
build-push:
917
runs-on: ubuntu-latest
@@ -15,24 +23,28 @@ jobs:
1523
run: |
1624
VERSION=$(grep 'VERSION' pkg/version/version.go | awk '{ print $4 }' | tr -d '"')
1725
CHANGELOG="https://github.com/fluxcd/flagger/blob/main/CHANGELOG.md#$(echo $VERSION | tr -d '.')"
26+
echo "[CHANGELOG](${CHANGELOG})" > notes.md
1827
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
1928
echo ::set-output name=VERSION::${VERSION}
20-
echo ::set-output name=CHANGELOG::${CHANGELOG}
2129
- name: Setup QEMU
2230
uses: docker/setup-qemu-action@v1
23-
with:
24-
platforms: all
2531
- name: Setup Docker Buildx
2632
id: buildx
2733
uses: docker/setup-buildx-action@v1
28-
with:
29-
buildkitd-flags: "--debug"
3034
- name: Login to GitHub Container Registry
3135
uses: docker/login-action@v1
3236
with:
3337
registry: ghcr.io
3438
username: fluxcdbot
3539
password: ${{ secrets.GHCR_TOKEN }}
40+
- name: Generate image meta
41+
id: meta
42+
uses: docker/metadata-action@v3
43+
with:
44+
images: |
45+
${{ env.IMAGE }}
46+
tags: |
47+
type=raw,value=${{ steps.prep.outputs.VERSION }}
3648
- name: Publish image
3749
uses: docker/build-push-action@v2
3850
with:
@@ -43,42 +55,31 @@ jobs:
4355
platforms: linux/amd64,linux/arm64,linux/arm/v7
4456
build-args: |
4557
REVISON=${{ github.sha }}
46-
tags: |
47-
ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }}
48-
labels: |
49-
org.opencontainers.image.title=${{ github.event.repository.name }}
50-
org.opencontainers.image.description=${{ github.event.repository.description }}
51-
org.opencontainers.image.url=${{ github.event.repository.html_url }}
52-
org.opencontainers.image.source=${{ github.event.repository.html_url }}
53-
org.opencontainers.image.revision=${{ github.sha }}
54-
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
55-
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}
5660
- name: Sign image
5761
run: |
5862
echo -n "${{secrets.COSIGN_PASSWORD}}" | \
5963
cosign sign -key ./.cosign/cosign.key -a git_sha=$GITHUB_SHA \
60-
ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }}
64+
${{ env.IMAGE }}:${{ steps.prep.outputs.VERSION }}
6165
- name: Check images
6266
run: |
63-
docker buildx imagetools inspect ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }}
67+
docker buildx imagetools inspect ${{ env.IMAGE }}:${{ steps.prep.outputs.VERSION }}
6468
- name: Verifiy image signature
6569
run: |
6670
cosign verify -key ./.cosign/cosign.pub \
67-
ghcr.io/fluxcd/flagger:${{ steps.prep.outputs.VERSION }}
71+
${{ env.IMAGE }}:${{ steps.prep.outputs.VERSION }}
6872
- name: Publish Helm charts
6973
uses: stefanprodan/[email protected]
7074
with:
7175
token: ${{ secrets.GITHUB_TOKEN }}
7276
charts_url: https://flagger.app
7377
linting: off
74-
- name: Create release
75-
uses: actions/create-release@latest
78+
- uses: anchore/sbom-action/download-syft@v0
79+
- name: Create release and SBOM
80+
uses: goreleaser/goreleaser-action@v2
81+
with:
82+
version: latest
83+
args: release --release-notes=notes.md --rm-dist --skip-validate
7684
env:
7785
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
with:
79-
tag_name: ${{ github.ref }}
80-
release_name: ${{ github.ref }}
81-
draft: false
82-
prerelease: false
83-
body: |
84-
[CHANGELOG](${{ steps.prep.outputs.CHANGELOG }})

.github/workflows/scan.yml

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
schedule:
99
- cron: '18 10 * * 3'
1010

11+
permissions:
12+
contents: read # for actions/checkout to fetch code
13+
security-events: write # for codeQL to write security events
14+
1115
jobs:
1216
fossa:
1317
name: FOSSA

.goreleaser.yml

+16-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
project_name: flagger
2+
13
builds:
2-
- main: ./cmd/flagger
3-
binary: flagger
4-
ldflags: -s -w -X github.com/fluxcd/flagger/pkg/version.REVISION={{.Commit}}
5-
goos:
6-
- linux
7-
goarch:
8-
- amd64
9-
env:
10-
- CGO_ENABLED=0
11-
archives:
12-
- name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
13-
files:
14-
- none*
4+
- skip: true
5+
6+
release:
7+
prerelease: auto
8+
9+
source:
10+
enabled: true
11+
name_template: "{{ .ProjectName }}_{{ .Version }}_source_code"
12+
13+
sboms:
14+
- id: source
15+
artifacts: source
16+
documents:
17+
- "{{ .ProjectName }}_{{ .Version }}_sbom.spdx.json"

0 commit comments

Comments
 (0)