Skip to content

Commit c4e4bf3

Browse files
committed
ci: Add image descriptions and source
More information in case the image is consumed via different sources than the official one. While at it, make the action steps more readable by adding separating newlines. Signed-off-by: Jan Kiszka <[email protected]>
1 parent 9103719 commit c4e4bf3

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

.github/actions/docker-init/action.yml

+34-3
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,87 @@ inputs:
55
required: true
66
deploy-token:
77
required: true
8-
cache-key:
8+
image-name:
99
required: true
1010

1111
runs:
1212
using: composite
1313
steps:
1414
- name: Set up QEMU
1515
uses: docker/setup-qemu-action@v3
16+
1617
- name: Set up Docker Buildx
1718
uses: docker/setup-buildx-action@v3
1819
with:
1920
driver-opts: image=moby/buildkit:v0.13.0
21+
2022
- name: Login to ghcr.io
2123
uses: docker/login-action@v3
2224
with:
2325
registry: ghcr.io
2426
username: ${{ inputs.deploy-user }}
2527
password: ${{ inputs.deploy-token }}
28+
2629
- name: Set SOURCE_DATE_EPOCH
2730
run: |
2831
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
2932
shell: bash
33+
3034
- name: Determine Debian tag
3135
run: |
3236
DEBIAN_RELEASE=$(grep -m 1 'ARG DEBIAN_TAG=' Dockerfile | sed 's/.*DEBIAN_TAG=\(.*\)-.*/\1/')
3337
echo "DEBIAN_TAG=$(podman image search --list-tags debian --limit 1000000000 | \
3438
grep "$DEBIAN_RELEASE-.*-slim" | sort -r | head -1 | sed 's/.*[ ]\+//')" >> $GITHUB_ENV
3539
shell: bash
40+
3641
- name: Prepare repository for COPY-in
3742
run: |
3843
git clone . /home/runner/kas-clone
3944
shell: bash
45+
46+
- name: Define image description
47+
run: |
48+
case ${{ inputs.image-name }} in
49+
kas)
50+
echo "IMAGE_DESCRIPTION=kas build environment for Yocto/OpenEmbedded projects" >> $GITHUB_ENV
51+
;;
52+
kas-isar)
53+
echo "IMAGE_DESCRIPTION=kas build environment for isar-based Debian projects" >> $GITHUB_ENV
54+
;;
55+
esac
56+
shell: bash
57+
58+
- name: Extract metadata
59+
id: meta
60+
uses: docker/metadata-action@v5
61+
with:
62+
annotations: |
63+
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
64+
org.opencontainers.image.licenses=MIT and others
65+
env:
66+
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
67+
4068
- name: Cache var-cache-apt
4169
id: cache-var-cache-apt
4270
uses: actions/cache@v4
4371
with:
4472
path: var-cache-apt
45-
key: var-cache-apt-${{ env.DEBIAN_TAG }}-${{ inputs.cache-key }}
73+
key: var-cache-apt-${{ env.DEBIAN_TAG }}-${{ inputs.image-name }}
74+
4675
- name: Cache var-lib-apt
4776
id: cache-var-lib-apt
4877
uses: actions/cache@v4
4978
with:
5079
path: var-lib-apt
51-
key: var-lib-apt-${{ env.DEBIAN_TAG }}-${{ inputs.cache-key }}
80+
key: var-lib-apt-${{ env.DEBIAN_TAG }}-${{ inputs.image-name }}
81+
5282
- name: Inject var-cache-apt into docker
5383
uses: reproducible-containers/[email protected]
5484
with:
5585
cache-source: var-cache-apt
5686
cache-target: /var/cache/apt
5787
skip-extraction: ${{ steps.cache-var-cache-apt.outputs.cache-hit }}
88+
5889
- name: Inject var-lib-apt into docker
5990
uses: reproducible-containers/[email protected]
6091
with:

.github/workflows/master.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
deploy-user: ${{ github.actor }}
3232
deploy-token: ${{ secrets.GITHUB_TOKEN }}
33-
cache-key: ${{ matrix.image-name }}
33+
image-name: ${{ matrix.image-name }}
3434
- name: Build ${{ matrix.image-name }} image
3535
uses: docker/build-push-action@v5
3636
if: ${{ env.PUSH_MASTER }}
@@ -44,3 +44,4 @@ jobs:
4444
provenance: mode=max,reproducible=true
4545
outputs: type=registry,rewrite-timestamp=true
4646
tags: ghcr.io/siemens/kas/${{ matrix.image-name }}
47+
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}

.github/workflows/next.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
with:
7777
deploy-user: ${{ github.actor }}
7878
deploy-token: ${{ secrets.GITHUB_TOKEN }}
79-
cache-key: ${{ matrix.image-name }}
79+
image-name: ${{ matrix.image-name }}
8080

8181
- name: Build ${{ matrix.image-name }} image
8282
uses: docker/build-push-action@v5
@@ -105,3 +105,4 @@ jobs:
105105
provenance: mode=max,reproducible=true
106106
outputs: type=registry,rewrite-timestamp=true
107107
tags: ghcr.io/siemens/kas/${{ matrix.image-name }}:next
108+
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}

.github/workflows/release.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
deploy-user: ${{ github.actor }}
2424
deploy-token: ${{ secrets.GITHUB_TOKEN }}
25-
cache-key: ${{ matrix.image-name }}
25+
image-name: ${{ matrix.image-name }}
2626
- name: Build ${{ matrix.image-name }} image
2727
uses: docker/build-push-action@v5
2828
with:
@@ -38,3 +38,4 @@ jobs:
3838
ghcr.io/siemens/kas/${{ matrix.image-name }}
3939
ghcr.io/siemens/kas/${{ matrix.image-name }}:${{ env.RELEASE_VERSION }}
4040
ghcr.io/siemens/kas/${{ matrix.image-name }}:latest-release
41+
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}

0 commit comments

Comments
 (0)