Adding tests for testing effective_* image #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # Build and push iib-api and iib-worker images after every merge to main. | |
| # | |
| # Job orchestration: | |
| # - iib-api: always built (uses UBI9 directly, no base-image dependency). | |
| # - iib-base-image: built only when docker/Dockerfile-base-image changed in the push. | |
| # - iib-worker: always built, but waits for iib-base-image when that job ran so the | |
| # worker image pulls the freshly pushed base image from Quay (not a stale :latest). | |
| # | |
| # Tags pushed to quay.io/exd-guild-hello-operator: iib-api:ocp-latest, iib-worker:ocp-latest. | |
| # For release-tagged images see .github/workflows/build.yml. | |
| # | |
| # Bootstrap: iib-base-image:latest must already exist on Quay before the first run (see | |
| # docker/README.md). Trigger build_base_image.yml manually via workflow_dispatch once. | |
| name: Build images on main merge | |
| permissions: | |
| contents: read | |
| on: | |
| # Runs on every push to main, including PR merges. | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| # Detect whether this push modified the base image Dockerfile. | |
| # Output base_image=true triggers the reusable base-image workflow below. | |
| detect_changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| base_image: ${{ steps.filter.outputs.base_image }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # Full history so paths-filter can diff against the previous commit on main. | |
| fetch-depth: 0 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| base_image: | |
| - 'docker/Dockerfile-base-image' | |
| # Runs only when docker/Dockerfile-base-image changed in this push. | |
| # Skipped otherwise; iib-worker proceeds without waiting. | |
| build_base_image: | |
| needs: detect_changes | |
| if: needs.detect_changes.outputs.base_image == 'true' | |
| uses: ./.github/workflows/build_base_image.yml | |
| secrets: | |
| REGISTRY_QUAY_IO_USER: ${{ secrets.REGISTRY_QUAY_IO_USER }} | |
| REGISTRY_QUAY_IO_PASSWORD: ${{ secrets.REGISTRY_QUAY_IO_PASSWORD }} | |
| # Always runs in parallel with detect_changes / build_base_image. | |
| # Does not depend on iib-base-image (Dockerfile-api starts from UBI9). | |
| build_iib_api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Build iib-api | |
| id: build-iib-api | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| image: iib-api | |
| tags: ocp-latest | |
| dockerfiles: | | |
| ./docker/Dockerfile-api | |
| - name: Push iib-api to quay.io | |
| id: push-iib-api | |
| uses: redhat-actions/push-to-registry@v2.7.1 | |
| with: | |
| image: ${{ steps.build-iib-api.outputs.image }} | |
| tags: ${{ steps.build-iib-api.outputs.tags }} | |
| registry: quay.io/exd-guild-hello-operator | |
| username: ${{ secrets.REGISTRY_QUAY_IO_USER }} | |
| password: ${{ secrets.REGISTRY_QUAY_IO_PASSWORD }} | |
| # Always runs after build_base_image completes or is skipped. | |
| # Waits when base image was rebuilt so Dockerfile-workers can FROM the new :latest on Quay. | |
| # Skipped only if build_base_image failed (worker must not build against a failed base push). | |
| build_iib_worker: | |
| needs: [detect_changes, build_base_image] | |
| if: | | |
| always() && | |
| !cancelled() && | |
| (needs.build_base_image.result == 'success' || needs.build_base_image.result == 'skipped') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Build iib-worker | |
| id: build-iib-worker | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| image: iib-worker | |
| tags: ocp-latest | |
| dockerfiles: | | |
| ./docker/Dockerfile-workers | |
| - name: Push iib-worker to quay.io | |
| id: push-iib-worker | |
| uses: redhat-actions/push-to-registry@v2.7.1 | |
| with: | |
| image: ${{ steps.build-iib-worker.outputs.image }} | |
| tags: ${{ steps.build-iib-worker.outputs.tags }} | |
| registry: quay.io/exd-guild-hello-operator | |
| username: ${{ secrets.REGISTRY_QUAY_IO_USER }} | |
| password: ${{ secrets.REGISTRY_QUAY_IO_PASSWORD }} |