Skip to content

Commit

Permalink
feat: Add missing annotations to multi arch images
Browse files Browse the repository at this point in the history
  • Loading branch information
dploeger committed Apr 12, 2024
1 parent fb52d2a commit 6997afe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: "Build Images"

on:
push:
branches:
- main
- develop
release:
types:
- published
Expand Down Expand Up @@ -39,7 +36,7 @@ jobs:
uses: actions/checkout@v2

- name: Install cosign
uses: sigstore/cosign-installer@v2.8.1
uses: sigstore/cosign-installer@v3.5.0

# Set up QEMU to be able to build to multiple architectures
- name: Set up QEMU
Expand Down Expand Up @@ -67,18 +64,27 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
- name: Prepare build
id: prepare
run: |
export BUILD_DATE=$(date -Iseconds)
export FLAVOUR=${{ matrix.flavour.name }}
cat build/Dockerfile.prefix > Dockerfile
cat "flavour/${{ matrix.flavour.name }}/Dockerfile.flavour" >> Dockerfile
# Download mo
curl -sSL https://raw.githubusercontent.com/tests-always-included/mo/master/mo -o mo
chmod +x mo
cat build/Dockerfile.suffix.mo | BUILD_DATE=$(date -Iseconds) FLAVOUR=${{ matrix.flavour.name }} ./mo > build/Dockerfile.suffix
cat build/Dockerfile.suffix.mo | ./mo > build/Dockerfile.suffix
cat build/Dockerfile.suffix >> Dockerfile
{
echo 'labels<<EOF'
cat build/labels.txt.mo | ./mo | sed -re "s/^/ /gm" # Add whitespace to insert it as annotations
echo EOF
} >> "$GITHUB_OUTPUT"
rm mo
env:
FLAVOUR: "${{ matrix.flavour.name }}"
Expand All @@ -89,17 +95,17 @@ jobs:
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4.0.0
uses: docker/build-push-action@v5.3.0
with:
context: .
push: true
pull: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: |
${{ steps.prepare.outputs.labels }}
no-cache: true
platforms: ${{ matrix.flavour.platforms }}

- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: "true"
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign --yes {}@${{ steps.build-and-push.outputs.digest }}
16 changes: 16 additions & 0 deletions build/labels.txt.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
index:io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dodevops/cloudcontrol/develop/README.md
index:org.opencontainers.image.created={{BUILD_DATE}}
index:org.opencontainers.image.description="The cloud engineer's toolbox - {{FLAVOUR}} flavour"
index:org.opencontainers.image.documentation=https://github.com/dodevops/cloudcontrol
index:org.opencontainers.image.source=https://github.com/dodevops/cloudcontrol
index:org.opencontainers.image.title="cloudcontrol-{{FLAVOUR}}"
index:org.opencontainers.image.url=https://github.com/dodevops/cloudcontrol
index:org.opencontainers.image.vendor="DO! DevOps"
manifest:io.artifacthub.package.readme-url=https://raw.githubusercontent.com/dodevops/cloudcontrol/develop/README.md
manifest:org.opencontainers.image.created={{BUILD_DATE}}
manifest:org.opencontainers.image.description="The cloud engineer's toolbox - {{FLAVOUR}} flavour"
manifest:org.opencontainers.image.documentation=https://github.com/dodevops/cloudcontrol
manifest:org.opencontainers.image.source=https://github.com/dodevops/cloudcontrol
manifest:org.opencontainers.image.title="cloudcontrol-{{FLAVOUR}}"
manifest:org.opencontainers.image.url=https://github.com/dodevops/cloudcontrol
manifest:org.opencontainers.image.vendor="DO! DevOps"

0 comments on commit 6997afe

Please sign in to comment.