From 9e03158f812b6893ed287f1131e14aff6ec883c2 Mon Sep 17 00:00:00 2001 From: Xaver Russ Date: Mon, 14 Jul 2025 00:45:11 +0200 Subject: [PATCH] more tests --- .forgejo/workflows/ansible.yml | 42 +++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.forgejo/workflows/ansible.yml b/.forgejo/workflows/ansible.yml index bba5feb..b72b88e 100644 --- a/.forgejo/workflows/ansible.yml +++ b/.forgejo/workflows/ansible.yml @@ -4,11 +4,11 @@ on: branches: - main paths: - - 'containers/${{ github.workflow }}/**' + - 'containers/${{ github.workflow }}/**' # This path will look for 'containers/Build and Push Ansible Container/**' - '.forgejo/workflows/ansible.yml' workflow_dispatch: {} schedule: - - cron: '0 20 * * 5' + - cron: '0 20 * * 5' # Runs every Friday at 8 PM UTC jobs: build-and-push: @@ -17,17 +17,21 @@ jobs: arch: [ amd64, arm64 ] runs-on: ${{ matrix.arch }} container: - image: ubuntu-latest + # Use a more suitable base image for package management and common tools. + # Debian is often a good balance between size and available packages. + # You're using `apk` (Alpine Linux package manager) in an Ubuntu container, which will fail. + image: debian:stable-slim # or debian:bookworm-slim, or even a specific Node.js image if you mainly need Node.js steps: - - name: Install Node.js and dependencies + - name: Install build dependencies (apt) run: | - apk update - apk add --no-cache nodejs npm git bash + # Use apt for Debian/Ubuntu based images + apt-get update + apt-get install -y nodejs npm git bash ca-certificates curl - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 - - name: Set up Docker Builder + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Forgejo Registry @@ -37,29 +41,30 @@ jobs: username: ${{ secrets.CI_REGISTRY_USER }} password: ${{ secrets.CI_TOKEN }} - - name: Set working directory - run: | - cd containers/${{ github.workflow }}/ - shell: bash + # Removed the `cd` step as `context` and `file` can handle the path directly. - name: Build and push (${{ matrix.arch }}) uses: docker/build-push-action@v5 with: - context: containers/${{ github.workflow }}/ - file: containers/${{ github.workflow }}/Dockerfile + context: ./containers/${{ github.workflow }}/ # Relative to the checkout root + file: ./containers/${{ github.workflow }}/Dockerfile # Relative to the checkout root platforms: linux/${{ matrix.arch }} push: true tags: | ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:${{ matrix.arch }}-latest + cache-from: type=registry,ref=${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:buildcache-${{ matrix.arch }} # Add caching + cache-to: type=registry,ref=${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:buildcache-${{ matrix.arch }},mode=max # Add caching manifest: needs: build-and-push - runs-on: amd64 + runs-on: ubuntu-latest # or amd64 if you have a specific AMD64 runner for manifest creation steps: - - name: Install Node.js and dependencies + - name: Install Docker CLI run: | - apk update - apk add --no-cache nodejs npm git bash + # Ensure docker CLI is available in the runner environment for `docker manifest` + # Most `ubuntu-latest` runners already have it, but explicit is better. + sudo apt-get update + sudo apt-get install -y docker-ce-cli # Install only the client if the runner is not dind - name: Login to Forgejo Registry uses: docker/login-action@v3 @@ -70,6 +75,7 @@ jobs: - name: Create and push multi-arch manifest run: | + # Use the explicit "docker" command which should be available docker manifest create ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest \ ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:amd64-latest \ ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:arm64-latest