Skip to content

Commit c913909

Browse files
dploegerDennis Ploeger
authored andcommitted
feat: Add missing annotations to multi arch images
1 parent 5b1e2a1 commit c913909

2 files changed

Lines changed: 32 additions & 10 deletions

File tree

.github/workflows/image.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: "Build Images"
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- develop
85
release:
96
types:
107
- published
@@ -39,7 +36,7 @@ jobs:
3936
uses: actions/checkout@v2
4037

4138
- name: Install cosign
42-
uses: sigstore/cosign-installer@v2.8.1
39+
uses: sigstore/cosign-installer@v3.5.0
4340

4441
# Set up QEMU to be able to build to multiple architectures
4542
- name: Set up QEMU
@@ -67,18 +64,27 @@ jobs:
6764
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
6865
6966
- name: Prepare build
67+
id: prepare
7068
run: |
69+
export BUILD_DATE=$(date -Iseconds)
70+
export FLAVOUR=${{ matrix.flavour.name }}
71+
7172
cat build/Dockerfile.prefix > Dockerfile
7273
cat "flavour/${{ matrix.flavour.name }}/Dockerfile.flavour" >> Dockerfile
7374
7475
# Download mo
7576
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
7677
chmod +x mo
7778
78-
cat build/Dockerfile.suffix.mo | BUILD_DATE=$(date -Iseconds) FLAVOUR=${{ matrix.flavour.name }} ./mo > build/Dockerfile.suffix
79-
79+
cat build/Dockerfile.suffix.mo | ./mo > build/Dockerfile.suffix
8080
cat build/Dockerfile.suffix >> Dockerfile
8181
82+
{
83+
echo 'labels<<EOF'
84+
cat build/labels.txt.mo | ./mo | sed -re "s/^/ /gm" # Add whitespace to insert it as annotations
85+
echo EOF
86+
} >> "$GITHUB_OUTPUT"
87+
8288
rm mo
8389
env:
8490
FLAVOUR: "${{ matrix.flavour.name }}"
@@ -89,17 +95,17 @@ jobs:
8995
9096
- name: Build and push Docker image
9197
id: build-and-push
92-
uses: docker/build-push-action@v4.0.0
98+
uses: docker/build-push-action@v5.3.0
9399
with:
94100
context: .
95101
push: true
96102
pull: true
97103
tags: ${{ steps.meta.outputs.tags }}
98104
labels: ${{ steps.meta.outputs.labels }}
105+
annotations: |
106+
${{ steps.prepare.outputs.labels }}
99107
no-cache: true
100108
platforms: ${{ matrix.flavour.platforms }}
101109

102110
- name: Sign the published Docker image
103-
env:
104-
COSIGN_EXPERIMENTAL: "true"
105-
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
111+
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}

build/labels.txt.mo

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
index:io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dodevops/cloudcontrol/develop/README.md
2+
index:org.opencontainers.image.created={{BUILD_DATE}}
3+
index:org.opencontainers.image.description="The cloud engineer's toolbox - {{FLAVOUR}} flavour"
4+
index:org.opencontainers.image.documentation=https://github.com/dodevops/cloudcontrol
5+
index:org.opencontainers.image.source=https://github.com/dodevops/cloudcontrol
6+
index:org.opencontainers.image.title="cloudcontrol-{{FLAVOUR}}"
7+
index:org.opencontainers.image.url=https://github.com/dodevops/cloudcontrol
8+
index:org.opencontainers.image.vendor="DO! DevOps"
9+
manifest:io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dodevops/cloudcontrol/develop/README.md
10+
manifest:org.opencontainers.image.created={{BUILD_DATE}}
11+
manifest:org.opencontainers.image.description="The cloud engineer's toolbox - {{FLAVOUR}} flavour"
12+
manifest:org.opencontainers.image.documentation=https://github.com/dodevops/cloudcontrol
13+
manifest:org.opencontainers.image.source=https://github.com/dodevops/cloudcontrol
14+
manifest:org.opencontainers.image.title="cloudcontrol-{{FLAVOUR}}"
15+
manifest:org.opencontainers.image.url=https://github.com/dodevops/cloudcontrol
16+
manifest:org.opencontainers.image.vendor="DO! DevOps"

0 commit comments

Comments
 (0)