diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index a34509d..1b6df0e 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -12,9 +12,7 @@ jobs: build-container: if: > github.event_name == 'push' || - github.event_name == 'issue_comment' || - ( github.event_name == 'pull_request' && - contains(github.event.pull_request.labels.*.name, 'auto-test') ) + github.event_name == 'issue_comment' name: Build Container Image env: JOB_NAME: Build Container Image @@ -23,6 +21,18 @@ jobs: contents: read packages: write statuses: write + strategy: + matrix: + os: + - registry.fedoraproject.org/fedora + - registry.access.redhat.com/ubi8/ubi + include: + - os: registry.fedoraproject.org/fedora + tag: 39 + - os: registry.access.redhat.com/ubi8/ubi + tag: latest + append: ubi + steps: - name: Checkout uses: actions/checkout@v4 @@ -66,7 +76,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - ghcr.io/${{ github.repository }} + ghcr.io/${{ github.repository }}${{ matrix.append && format('-{0}', matrix.append) }} tags: | type=ref,event=branch type=ref,event=pr @@ -79,10 +89,19 @@ jobs: uses: docker/metadata-action@v5 with: images: | - ghcr.io/${{ github.repository }} + ghcr.io/${{ github.repository }}${{ matrix.append && format('-{0}', matrix.append) }} tags: | pr-${{ inputs.pr }} + - name: Get UBI Subs + if: matrix.append == 'ubi' + uses: actions/checkout@v4 + with: + repository: ${{ secrets.RH_REPO }} + token: ${{ secrets.RH_ENT }} + persist-credentials: false + path: ubi + - name: Buildah Build id: build-image uses: redhat-actions/buildah-build@v2 @@ -90,6 +109,11 @@ jobs: containerfiles: Containerfile tags: ${{ steps.meta.outputs.tags || steps.meta_pr.outputs.tags }} labels: ${{ steps.meta.outputs.labels || steps.meta_pr.outputs.labels }} + build-args: | + BASE_IMAGE=${{ matrix.os }} + IMAGE_VERSION=${{ matrix.tag }} + extra-args: | + ${{ matrix.append == 'ubi' && '--volume=./ubi:/etc/pki/entitlement-host' }} - name: Push image uses: redhat-actions/push-to-registry@v2 @@ -107,4 +131,4 @@ jobs: status: ${{ job.status }} context: ${{ env.JOB_NAME }} sha: ${{ env.sha }} - targetUrl: ${{ steps.jobs.outputs.html_url }} \ No newline at end of file + targetUrl: ${{ steps.jobs.outputs.html_url }} diff --git a/Containerfile b/Containerfile index fc097e5..dcfbbd1 100644 --- a/Containerfile +++ b/Containerfile @@ -1,6 +1,8 @@ -FROM fedora:40 +ARG BASE_IMAGE +ARG IMAGE_VERSION +FROM ${BASE_IMAGE}:${IMAGE_VERSION} -ARG VERSION=40 +ARG VERSION=39 ENV ARCH="x86_64" ENV IMAGE_NAME="base"