fix CI not being allowed to push container image
Some checks failed
Build Container / Build Container (push) Failing after 34s

This commit is contained in:
lilly 2026-05-14 19:07:06 +02:00
commit c1834a28ed
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g

View file

@ -4,9 +4,6 @@ on:
workflow_dispatch: {} workflow_dispatch: {}
push: {} push: {}
permissions:
packages: write
jobs: jobs:
build-container: build-container:
name: Build Container name: Build Container
@ -14,24 +11,39 @@ jobs:
container: container:
image: ghcr.io/osscontainertools/kaniko:alpine image: ghcr.io/osscontainertools/kaniko:alpine
steps: steps:
- name: Install NodeJS for actions compatibility - name: Install required system packages compatibility
run: apk add --no-cache nodejs run: apk add --no-cache nodejs
- name: Checkout source code - name: Checkout source code
uses: actions/checkout@v6 uses: actions/checkout@v6
- name: Login to container registry (prod only) - name: Login to container registry (prod only)
if: ${{ forgejo.ref_name == 'main' }} if: ${{ forgejo.ref_name == 'main' }}
run: /kaniko/executor login --username="forgejo-actions" --password="${{ forgejo.token }}" git.hamburg.ccc.de run: /kaniko/executor login --username="forgejo-actions" --password="${{ secrets.PACKAGES_TOKEN }}" git.hamburg.ccc.de
- run: |
echo "--- cating file ---"
cat /root/.docker/config.json
echo "--- end of file ---"
- name: Build Container - name: Build Container
env: # env:
KANIKO_NO_PUSH: ${{ forgejo.ref_name != 'main' }} # KANIKO_NO_PUSH: ${{ forgejo.ref_name != 'main' }}
run: /kaniko/executor run: /kaniko/executor
--dockerfile="${{forgejo.workspace }}/Containerfile" --dockerfile="${{forgejo.workspace }}/Containerfile"
--context="dir://${{ forgejo.workspace }}" --context="dir://${{ forgejo.workspace }}"
--destination=git.hamburg.ccc.de/ccchh/dooris:latest --destination=git.hamburg.ccc.de/ccchh/dooris:latest
--credential-helpers=env --tar-path=${{ forgejo.workspace }}/image.tar
--no-push
--no-push-cache --no-push-cache
--annotation=org.opencontainers.image.ref.name=dooris --annotation=org.opencontainers.image.ref.name=dooris
--annotation=org.opencontainers.image.url=${{ forgejo.server_url }}/${{ forgejo.repository }} --annotation=org.opencontainers.image.url=${{ forgejo.server_url }}/${{ forgejo.repository }}
--annotation=org.opencontainers.image.source=${{ forgejo.server_url }}/${{ forgejo.repository }} --annotation=org.opencontainers.image.source=${{ forgejo.server_url }}/${{ forgejo.repository }}
--annotation=org.opencontainers.image.licenses=AGPL-3.0 --annotation=org.opencontainers.image.licenses=AGPL-3.0
- name: Push Container
if: ${{ forgejo.ref_name == 'main' }}
run: |
apk add --no-cache skopeo
skopeo copy "archive:${{ forgejo.workspace }}/image.tar" docker://git.hamburg.ccc.de/ccchh/dooris:latest --dest-authfile=/root/.docker/config.json