Skip to content

Commit e773db2

Browse files
committed
ci: #78 Add cosign signature + sbom + provenance attestations
Signed-off-by: Laurent Broudoux <[email protected]>
1 parent cb9a6d1 commit e773db2

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

.github/workflows/build-verify.yml

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ on:
1212
- '.gitignore'
1313
- 'LICENSE'
1414
- '*.md'
15-
permissions: read-all
15+
permissions:
16+
contents: read
17+
id-token: write # needed for signing the images with GitHub OIDC Token
18+
1619
jobs:
1720
build-verify-package:
1821
runs-on: ubuntu-latest
@@ -48,6 +51,9 @@ jobs:
4851
echo "PACKAGE_IMAGE=false" >> "$GITHUB_ENV"
4952
fi
5053
54+
- name: Install Cosign
55+
uses: sigstore/[email protected]
56+
5157
- name: Set up QEMU
5258
if: github.repository_owner == 'microcks' && env.PACKAGE_IMAGE == 'true'
5359
uses: docker/setup-qemu-action@v2
@@ -64,14 +70,29 @@ jobs:
6470
docker buildx inspect $BUILDER || docker buildx create --name=$BUILDER --driver=docker-container --driver-opt=network=host
6571
6672
- name: Build and push container image for cli
73+
id: build-and-push
74+
uses: docker/[email protected]
6775
if: github.repository_owner == 'microcks' && env.PACKAGE_IMAGE == 'true'
76+
with:
77+
context: .
78+
sbom: true
79+
push: true
80+
platforms: linux/amd64,linux/arm64
81+
builder: buildx-multi-arch
82+
file: build/Dockerfile
83+
labels: |
84+
org.opencontainers.image.revision=${GITHUB_SHA}
85+
org.opencontainers.image.created=${{ steps.date.outputs.date }}
86+
tags: quay.io/microcks/microcks-cli:${{env.IMAGE_TAG}}
87+
88+
- name: Sign the image with GitHub OIDC Token
89+
env:
90+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
91+
TAGS: quay.io/microcks/microcks-cli:${{env.IMAGE_TAG}}
92+
COSIGN_EXPERIMENTAL: "true"
6893
run: |
69-
docker buildx build --push \
70-
--platform=linux/amd64,linux/arm64 \
71-
--builder=buildx-multi-arch \
72-
--provenance=false \
73-
--build-arg TAG=$IMAGE_TAG \
74-
--file build/Dockerfile \
75-
--label "org.opencontainers.image.revision=${GITHUB_SHA}" \
76-
--label "org.opencontainers.image.created=${{ steps.date.outputs.date }}" \
77-
--tag=quay.io/microcks/microcks-cli:$IMAGE_TAG .
94+
images=""
95+
for tag in ${TAGS}; do
96+
images+="${tag}@${DIGEST} "
97+
done
98+
cosign sign --yes ${images}

0 commit comments

Comments
 (0)