Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/dpr/annotations #139

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
timdeluxe marked this conversation as resolved.
Show resolved Hide resolved
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"
Loading