diff --git a/.gitea/workflows/image_downloader_runner.yaml b/.gitea/workflows/image_downloader_runner.yaml index 196d3a3..b545384 100644 --- a/.gitea/workflows/image_downloader_runner.yaml +++ b/.gitea/workflows/image_downloader_runner.yaml @@ -36,12 +36,17 @@ jobs: runs-on: host-runner container: image: gitea.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:latest + volumes: + - /var/run/docker.sock:/var/run/docker.sock # 🚀 CRITICAL: Grants the container control of Docker + strategy: - # Prevents all other jobs from failing immediately if one image fails + max-parallel: 1 fail-fast: false matrix: image: ${{ fromJSON(needs.setup.outputs.image_matrix) }} - + + name: Sync (${{ matrix.image }}) + steps: - name: Login to gitea uses: docker/login-action@v3 @@ -54,10 +59,26 @@ jobs: - name: docker pull ${{ matrix.image }} run: docker pull ${{ matrix.image }} - - name: docker tag ${{ matrix.image }} to gitea.geeraert.eu/pi-ux-ce/${{ matrix.image }} - run: docker tag ${{ matrix.image }} gitea.geeraert.eu/pi-ux-ce/${{ matrix.image }} - - - - name: Push image - run: docker push gitea.geeraert.eu/pi-ux-ce/${{ matrix.image }} + - name: Process, Tag and Push to Gitea + run: | + RAW_IMAGE="${{ matrix.image }}" + + # Clean up the image name string to prevent malformed targets + # e.g., converts 'ghcr.io/bitwarden/admin:2026.1.0' into 'bitwarden-admin:2026.1.0' + CLEANED_NAME=$(echo "$RAW_IMAGE" | sed -E 's|^[^/]*/||' | tr '/' '-') + + TARGET_IMAGE="gitea.geeraert.eu/pi-ux-ce/${CLEANED_NAME}" + + echo "Original: $RAW_IMAGE" + echo "Target Registry Image: $TARGET_IMAGE" + + # Perform operations sequentially + docker tag "$RAW_IMAGE" "$TARGET_IMAGE" + docker push "$TARGET_IMAGE" + - name: Post Cleanup Host Storage + if: always() + run: | + CLEANED_NAME=$(echo "${{ matrix.image }}" | sed -E 's|^[^/]*/||' | tr '/' '-') + docker rmi "${{ matrix.image }}" || true + docker rmi "gitea.geeraert.eu/pi-ux-ce/${CLEANED_NAME}" || true