Skip to content

Commit 4e7c558

Browse files
committed
workflow: sign release containers
Signed-off-by: Tuomas Katila <[email protected]>
1 parent 8094452 commit 4e7c558

File tree

3 files changed

+30
-4
lines changed

3 files changed

+30
-4
lines changed

.github/workflows/devel.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848

4949
# devel image push
5050
publish:
51+
permissions:
52+
contents: read
53+
id-token: write
5154
needs:
5255
- e2e
5356
- build

.github/workflows/lib-publish.yaml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,24 @@ on:
66
default: "devel"
77
required: false
88
type: string
9+
registry:
10+
default: "docker.io/intel"
11+
required: false
12+
type: string
913
env:
1014
no_base_check: "['intel-qat-plugin-kerneldrv', 'intel-idxd-config-initcontainer', 'crypto-perf', 'opae-nlb-demo']"
1115

1216
permissions:
1317
contents: read
18+
id-token: write
1419

1520
jobs:
1621
image:
1722
name: Build image
1823
runs-on: ubuntu-22.04
24+
permissions:
25+
contents: read
26+
id-token: write
1927
strategy:
2028
fail-fast: false
2129
matrix:
@@ -52,21 +60,33 @@ jobs:
5260
env:
5361
IMAGE_NAME: ${{ matrix.image }}
5462
run: |
55-
REG=intel/ make ${IMAGE_NAME} BUILDER=docker
63+
ORG=${{ inputs.registry }} TAG=${{ inputs.image_tag }} make ${IMAGE_NAME} BUILDER=docker
5664
- name: Trivy scan for image
5765
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 # 0.24.0
5866
with:
5967
scan-type: image
60-
image-ref: intel/${{ matrix.image }}:${{ inputs.image_tag }}
68+
image-ref: ${{ inputs.registry }}/${{ matrix.image }}:${{ inputs.image_tag }}
6169
exit-code: 1
6270
- name: Test image base layer
6371
# Don't run base layer check for selected images
6472
if: ${{ !contains(fromJson(env.no_base_check), matrix.image) }}
65-
run: IMG=intel/${{ matrix.image }}:${{ inputs.image_tag }} make test-image-base-layer BUILDER=docker
73+
run: IMG=${{ inputs.registry }}/${{ matrix.image }}:${{ inputs.image_tag }} make test-image-base-layer BUILDER=docker
6674
- name: Login
6775
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
6876
with:
6977
username: ${{ secrets.DOCKERHUB_USER }}
7078
password: ${{ secrets.DOCKERHUB_PASS }}
7179
- name: Push
72-
run: docker push intel/${{ matrix.image }}:${{ inputs.image_tag }}
80+
run: docker push ${{ inputs.registry }}/${{ matrix.image }}:${{ inputs.image_tag }}
81+
- name: Get image digest
82+
if: ${{ inputs.image_tag != 'devel' }}
83+
id: digest
84+
run: |
85+
echo "image_sha=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ inputs.registry }}/${{ matrix.image }}:${{ inputs.image_tag }})" >> $GITHUB_OUTPUT
86+
- name: Install cosign
87+
if: ${{ inputs.image_tag != 'devel' }}
88+
uses: sigstore/[email protected]
89+
- name: Keyless image sign
90+
if: ${{ inputs.image_tag != 'devel' }}
91+
run: |
92+
cosign sign --yes ${{ steps.digest.outputs.image_sha }}

.github/workflows/release.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535

3636
build:
3737
name: Build & Publish
38+
permissions:
39+
contents: read
40+
id-token: write
3841
needs:
3942
- trivy
4043
- tag_fix

0 commit comments

Comments
 (0)