feat: use podman for build and better changes checks
Some checks failed
Build containers / dependent-images (infra) (push) Has been skipped
Build containers / changes (push) Successful in 3s
Build containers / fedora-base (push) Failing after 3s
Build containers / dependent-images (go) (push) Has been skipped

This commit is contained in:
Job
2025-12-27 14:52:11 +01:00
parent 40bb6328c4
commit c8d988f7c6

View File

@@ -1,60 +1,101 @@
name: Build container name: Build containers
on: on:
push: push:
branches: ["main"] branches: ["main"]
paths: paths: ["containers/**", ".gitea/workflows/fedora.yaml"]
- "containers/fedora/**"
- "containers/go/**"
- "containers/infra/**"
- ".gitea/workflows/fedora.yaml"
pull_request: pull_request:
branches: ["main"] branches: ["main"]
paths: paths: ["containers/**", ".gitea/workflows/fedora.yaml"]
- "containers/fedora/**"
- "containers/go/**"
- "containers/infra/**"
- ".gitea/workflows/fedora.yaml"
schedule: schedule:
- cron: "0 16 * * FRI" - cron: "0 16 * * FRI"
jobs: jobs:
fedora-build: changes:
runs-on: job-latest runs-on: job-v2
outputs:
fedora: ${{ steps.filter.outputs.fedora == 'true' }}
infra: ${{ steps.filter.outputs.infra == 'true' || steps.filter.outputs.fedora == 'true' }}
go: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.fedora == 'true' }}
any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' }}
steps: steps:
- name: Clone repo - uses: actions/checkout@v4
uses: actions/checkout@v4 - uses: https://github.com/dorny/paths-filter@v3
- name: Setup Docker Buildx id: filter
uses: docker/setup-buildx-action@v3 with:
- name: Login to Registry filters: |
uses: docker/login-action@v3 workflow: ['.gitea/workflows/fedora.yaml']
fedora: ['containers/fedora/**']
infra: ['containers/infra/**']
go: ['containers/go/**']
- name: debug
run: |
echo "$RUNNER_OS"
fedora-base:
needs: [changes]
if: ${{ needs.changes.outputs.fedora == 'true' || needs.changes.outputs.any_change == 'true' }}
runs-on: job-v2
steps:
- uses: actions/checkout@v4
- name: Log in
uses: redhat-actions/podman-login@v1
with: with:
registry: git.plabble.org registry: git.plabble.org
username: ${{ secrets.REGISTRY_USERNAME }} username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }} password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push fedora container - name: Build Fedora
uses: docker/build-push-action@v5 id: build
uses: redhat-actions/buildah-build@v2
with: with:
context: ./containers/fedora image: ${{ github.actor }}/fedora
file: ./containers/fedora/Containerfile tags: ${{ github.ref_name }}
push: true containerfiles: ./containers/fedora/Containerfile
tags: git.plabble.org/job79/fedora:${{ github.ref_name }} oci: true
build-args: TAG=${{ github.ref_name }} - name: Push Fedora
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true uses: redhat-actions/push-to-registry@v2
- name: Build and push go container
uses: docker/build-push-action@v5
with: with:
context: ./containers/go image: ${{ steps.build.outputs.image }}
file: ./containers/go/Containerfile tags: ${{ steps.build.outputs.tags }}
push: true registry: git.plabble.org
tags: git.plabble.org/job79/go:${{ github.ref_name }} extra-args: --compression-format=zstd:chunked
build-args: TAG=${{ github.ref_name }}
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true dependent-images:
- name: Build and push infra container needs: [changes, fedora-base]
uses: docker/build-push-action@v5 runs-on: job-v2
strategy:
fail-fast: false
matrix:
container: [infra, go]
steps:
- name: Check if build needed
id: check
run: |
if [[ "${{ matrix.container }}" == "infra" && "${{ needs.changes.outputs.infra }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
if [[ "${{ matrix.container }}" == "go" && "${{ needs.changes.outputs.go }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
- name: Clone repo
if: steps.check.outputs.run == 'true'
uses: actions/checkout@v4
- name: Log in
if: steps.check.outputs.run == 'true'
uses: redhat-actions/podman-login@v1
with: with:
context: ./containers/infra registry: git.plabble.org
file: ./containers/infra/Containerfile username: ${{ secrets.REGISTRY_USERNAME }}
push: true password: ${{ secrets.REGISTRY_TOKEN }}
tags: git.plabble.org/job79/infra:${{ github.ref_name }} - name: Build ${{ matrix.container }}
build-args: TAG=${{ github.ref_name }} if: steps.check.outputs.run == 'true'
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true id: build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ github.actor }}/${{ matrix.container }}
tags: ${{ github.ref_name }}
containerfiles: ./containers/${{ matrix.container }}/Containerfile
oci: true
- name: Push ${{ matrix.container }}
if: steps.check.outputs.run == 'true'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build.outputs.image }}
tags: ${{ steps.build.outputs.tags }}
registry: git.plabble.org
extra-args: --compression-format=zstd:chunked