Skip to content

Commit

Permalink
ci: Add image descriptions and source
Browse files Browse the repository at this point in the history
More information in case the image is consumed via different sources
than the official one.

Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
jan-kiszka committed Mar 9, 2024
1 parent 9103719 commit bfd2562
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
25 changes: 22 additions & 3 deletions .github/actions/docker-init/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
required: true
deploy-token:
required: true
cache-key:
image-name:
required: true

runs:
Expand Down Expand Up @@ -42,13 +42,13 @@ runs:
uses: actions/cache@v4
with:
path: var-cache-apt
key: var-cache-apt-${{ env.DEBIAN_TAG }}-${{ inputs.cache-key }}
key: var-cache-apt-${{ env.DEBIAN_TAG }}-${{ inputs.image-name }}
- name: Cache var-lib-apt
id: cache-var-lib-apt
uses: actions/cache@v4
with:
path: var-lib-apt
key: var-lib-apt-${{ env.DEBIAN_TAG }}-${{ inputs.cache-key }}
key: var-lib-apt-${{ env.DEBIAN_TAG }}-${{ inputs.image-name }}
- name: Inject var-cache-apt into docker
uses: reproducible-containers/[email protected]
with:
Expand All @@ -61,3 +61,22 @@ runs:
cache-source: var-lib-apt
cache-target: /var/lib/apt
skip-extraction: ${{ steps.cache-var-lib-apt.outputs.cache-hit }}
- name: Define metadata
run: |
case ${{ inputs.image-name }} in
kas)
echo "IMAGE_DESCRIPTION=\"kas build environment for Yocto/OpenEmbedded projects\"" >> $GITHUB_ENV
;;
kas-isar)
echo "IMAGE_DESCRIPTION=\"kas build environment for isar-based Debian projects\"" >> $GITHUB_ENV
;;
esac
shell: bash
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
annotations:
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses="MIT and others"
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
3 changes: 2 additions & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
with:
deploy-user: ${{ github.actor }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
cache-key: ${{ matrix.image-name }}
image-name: ${{ matrix.image-name }}
- name: Build ${{ matrix.image-name }} image
uses: docker/build-push-action@v5
if: ${{ env.PUSH_MASTER }}
Expand All @@ -44,3 +44,4 @@ jobs:
provenance: mode=max,reproducible=true
outputs: type=registry,rewrite-timestamp=true
tags: ghcr.io/siemens/kas/${{ matrix.image-name }}
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}
3 changes: 2 additions & 1 deletion .github/workflows/next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
with:
deploy-user: ${{ github.actor }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
cache-key: ${{ matrix.image-name }}
image-name: ${{ matrix.image-name }}

- name: Build ${{ matrix.image-name }} image
uses: docker/build-push-action@v5
Expand Down Expand Up @@ -105,3 +105,4 @@ jobs:
provenance: mode=max,reproducible=true
outputs: type=registry,rewrite-timestamp=true
tags: ghcr.io/siemens/kas/${{ matrix.image-name }}:next
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
deploy-user: ${{ github.actor }}
deploy-token: ${{ secrets.GITHUB_TOKEN }}
cache-key: ${{ matrix.image-name }}
image-name: ${{ matrix.image-name }}
- name: Build ${{ matrix.image-name }} image
uses: docker/build-push-action@v5
with:
Expand All @@ -38,3 +38,4 @@ jobs:
ghcr.io/siemens/kas/${{ matrix.image-name }}
ghcr.io/siemens/kas/${{ matrix.image-name }}:${{ env.RELEASE_VERSION }}
ghcr.io/siemens/kas/${{ matrix.image-name }}:latest-release
annotations: ${{ env.DOCKER_METADATA_OUTPUT_ANNOTATIONS }}

0 comments on commit bfd2562

Please sign in to comment.