From d4ed3cfa657053c01d550bb0565fb220861f6eb7 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 18:36:36 +0000 Subject: [PATCH 1/8] Refactor GitHub Actions to use a reusable build workflow - Created `.github/workflows/reusable-build.yaml` to centralize the build and push logic. - Updated `build.yaml` to call the reusable workflow. - Updated `build_and_push.yaml` to call the reusable workflow. - Removed duplicated code from both workflow files. --- .github/workflows/build.yaml | 32 +++---------------- .github/workflows/build_and_push.yaml | 43 ++++--------------------- .github/workflows/reusable-build.yaml | 46 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/reusable-build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e1973c1..921ea9f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,31 +2,9 @@ name: Build container image on: pull_request: -env: - IMAGE_NAME: ${{ github.event.repository.name }} - IMAGE_TAGS: ${{ github.sha }} - jobs: - build: - name: Build container image - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install qemu dependency - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - - - name: Build Image - id: build_image - uses: redhat-actions/buildah-build@v2 - with: - image: ${{ env.IMAGE_NAME }} - tags: ${{ env.IMAGE_TAGS }} - archs: amd64, arm64, ppc64le, riscv64, s390x - containerfiles: | - ./Dockerfile - + call-reusable-build: + uses: ./.github/workflows/reusable-build.yaml + with: + image_tags: ${{ github.sha }} + push_image: false diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index 69ad071..f8f3290 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -4,41 +4,10 @@ on: tags: - '*' -env: - IMAGE_NAME: ${{ github.event.repository.name }} - IMAGE_TAGS: ${{ github.ref_name }} - jobs: - push-quay: - name: Build container image - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install qemu dependency - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - - - name: Build Image - id: build_image - uses: redhat-actions/buildah-build@v2 - with: - image: ${{ env.IMAGE_NAME }} - tags: ${{ env.IMAGE_TAGS }} - archs: amd64, arm64, ppc64le, riscv64, s390x - containerfiles: | - ./Dockerfile - - - name: Push To Registry - uses: redhat-actions/push-to-registry@v2 - id: push_image - with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ steps.build_image.outputs.tags }} - registry: ${{ vars.IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} - + call-reusable-build: + uses: ./.github/workflows/reusable-build.yaml + with: + image_tags: ${{ github.ref_name }} + push_image: true + secrets: inherit diff --git a/.github/workflows/reusable-build.yaml b/.github/workflows/reusable-build.yaml new file mode 100644 index 0000000..3405ab0 --- /dev/null +++ b/.github/workflows/reusable-build.yaml @@ -0,0 +1,46 @@ +name: Reusable Build Workflow + +on: + workflow_call: + inputs: + image_tags: + required: true + type: string + push_image: + required: true + type: boolean + +jobs: + build: + name: Build container image + runs-on: ubuntu-24.04 + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Build Image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ github.event.repository.name }} + tags: ${{ inputs.image_tags }} + archs: amd64, arm64, ppc64le, riscv64, s390x + containerfiles: | + ./Dockerfile + + - name: Push To Registry + if: ${{ inputs.push_image }} + uses: redhat-actions/push-to-registry@v2 + id: push_image + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ vars.IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} From 0635b17b289e064fb88cbef0c61346a5e1c89414 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 18:50:45 +0000 Subject: [PATCH 2/8] Refactor GitHub Actions using a composite action - Created `.github/actions/build-image/action.yml` to encapsulate shared build steps. - Updated `build.yaml` and `build_and_push.yaml` to use the new composite action. - Kept the "Push To Registry" step in `build_and_push.yaml` as it is not shared. - Deleted the previously created `reusable-build.yaml` workflow. --- .github/actions/build-image/action.yml | 35 ++++++++++++++++++++ .github/workflows/build.yaml | 14 +++++--- .github/workflows/build_and_push.yaml | 26 +++++++++++---- .github/workflows/reusable-build.yaml | 46 -------------------------- 4 files changed, 64 insertions(+), 57 deletions(-) create mode 100644 .github/actions/build-image/action.yml delete mode 100644 .github/workflows/reusable-build.yaml diff --git a/.github/actions/build-image/action.yml b/.github/actions/build-image/action.yml new file mode 100644 index 0000000..686d7e2 --- /dev/null +++ b/.github/actions/build-image/action.yml @@ -0,0 +1,35 @@ +name: Build Image Action +description: Shared steps to checkout, setup qemu, and build container image +inputs: + image_tags: + description: Tags for the built image + required: true +outputs: + image: + description: Name of the built image + value: ${{ steps.build_image.outputs.image }} + tags: + description: Tags of the built image + value: ${{ steps.build_image.outputs.tags }} + +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install qemu dependency + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + + - name: Build Image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ github.event.repository.name }} + tags: ${{ inputs.image_tags }} + archs: amd64, arm64, ppc64le, riscv64, s390x + containerfiles: | + ./Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 921ea9f..4ccea23 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,8 +3,12 @@ on: pull_request: jobs: - call-reusable-build: - uses: ./.github/workflows/reusable-build.yaml - with: - image_tags: ${{ github.sha }} - push_image: false + build: + name: Build container image + runs-on: ubuntu-24.04 + + steps: + - name: Build Image + uses: ./.github/actions/build-image + with: + image_tags: ${{ github.sha }} diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index f8f3290..ef59901 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -5,9 +5,23 @@ on: - '*' jobs: - call-reusable-build: - uses: ./.github/workflows/reusable-build.yaml - with: - image_tags: ${{ github.ref_name }} - push_image: true - secrets: inherit + push-quay: + name: Build container image + runs-on: ubuntu-24.04 + + steps: + - name: Build Image + id: build_image + uses: ./.github/actions/build-image + with: + image_tags: ${{ github.ref_name }} + + - name: Push To Registry + uses: redhat-actions/push-to-registry@v2 + id: push_image + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ vars.IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/.github/workflows/reusable-build.yaml b/.github/workflows/reusable-build.yaml deleted file mode 100644 index 3405ab0..0000000 --- a/.github/workflows/reusable-build.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: Reusable Build Workflow - -on: - workflow_call: - inputs: - image_tags: - required: true - type: string - push_image: - required: true - type: boolean - -jobs: - build: - name: Build container image - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Install qemu dependency - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - - - name: Build Image - id: build_image - uses: redhat-actions/buildah-build@v2 - with: - image: ${{ github.event.repository.name }} - tags: ${{ inputs.image_tags }} - archs: amd64, arm64, ppc64le, riscv64, s390x - containerfiles: | - ./Dockerfile - - - name: Push To Registry - if: ${{ inputs.push_image }} - uses: redhat-actions/push-to-registry@v2 - id: push_image - with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ steps.build_image.outputs.tags }} - registry: ${{ vars.IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} From f37b19bea0827c7fe480776ce023845a76a9085a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 18:58:05 +0000 Subject: [PATCH 3/8] Refactor GitHub Actions using a composite action and fix build failure - Created `.github/actions/build-image/action.yml` to encapsulate shared build steps (qemu setup, image build). - Updated `build.yaml` and `build_and_push.yaml` to use the composite action. - Ensured `actions/checkout` is run before calling the local composite action in both workflows. - Kept the "Push To Registry" step in `build_and_push.yaml` as requested. --- .github/actions/build-image/action.yml | 5 +---- .github/workflows/build.yaml | 3 +++ .github/workflows/build_and_push.yaml | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-image/action.yml b/.github/actions/build-image/action.yml index 686d7e2..02e171b 100644 --- a/.github/actions/build-image/action.yml +++ b/.github/actions/build-image/action.yml @@ -1,5 +1,5 @@ name: Build Image Action -description: Shared steps to checkout, setup qemu, and build container image +description: Shared steps to setup qemu and build container image inputs: image_tags: description: Tags for the built image @@ -15,9 +15,6 @@ outputs: runs: using: "composite" steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Install qemu dependency shell: bash run: | diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4ccea23..10a69c0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -8,6 +8,9 @@ jobs: runs-on: ubuntu-24.04 steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Build Image uses: ./.github/actions/build-image with: diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml index ef59901..0d6c4cf 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/build_and_push.yaml @@ -10,6 +10,9 @@ jobs: runs-on: ubuntu-24.04 steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Build Image id: build_image uses: ./.github/actions/build-image From 0a1e7154c274962e7c9a6af055067b94d863c978 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 19:21:28 +0000 Subject: [PATCH 4/8] Consolidate GitHub Actions workflows to eliminate duplication - Merged `build.yaml` and `build_and_push.yaml` into a single `.github/workflows/build.yaml`. - Used conditional logic for the "Push To Registry" step to only run on tag pushes. - Implemented dynamic tagging (SHA for PRs, tag name for pushes). - Removed redundant workflow and composite action. --- .github/actions/build-image/action.yml | 32 -------------------------- .github/workflows/build.yaml | 31 +++++++++++++++++++++++-- .github/workflows/build_and_push.yaml | 30 ------------------------ 3 files changed, 29 insertions(+), 64 deletions(-) delete mode 100644 .github/actions/build-image/action.yml delete mode 100644 .github/workflows/build_and_push.yaml diff --git a/.github/actions/build-image/action.yml b/.github/actions/build-image/action.yml deleted file mode 100644 index 02e171b..0000000 --- a/.github/actions/build-image/action.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build Image Action -description: Shared steps to setup qemu and build container image -inputs: - image_tags: - description: Tags for the built image - required: true -outputs: - image: - description: Name of the built image - value: ${{ steps.build_image.outputs.image }} - tags: - description: Tags of the built image - value: ${{ steps.build_image.outputs.tags }} - -runs: - using: "composite" - steps: - - name: Install qemu dependency - shell: bash - run: | - sudo apt-get update - sudo apt-get install -y qemu-user-static - - - name: Build Image - id: build_image - uses: redhat-actions/buildah-build@v2 - with: - image: ${{ github.event.repository.name }} - tags: ${{ inputs.image_tags }} - archs: amd64, arm64, ppc64le, riscv64, s390x - containerfiles: | - ./Dockerfile diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 10a69c0..7b6d768 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,6 +1,12 @@ name: Build container image on: pull_request: + push: + tags: + - '*' + +env: + IMAGE_NAME: ${{ github.event.repository.name }} jobs: build: @@ -11,7 +17,28 @@ jobs: - name: Checkout uses: actions/checkout@v6 + - name: Install qemu dependency + run: | + sudo apt-get update + sudo apt-get install -y qemu-user-static + - name: Build Image - uses: ./.github/actions/build-image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_NAME }} + tags: ${{ github.event_name == 'pull_request' && github.sha || github.ref_name }} + archs: amd64, arm64, ppc64le, riscv64, s390x + containerfiles: | + ./Dockerfile + + - name: Push To Registry + if: github.event_name == 'push' && github.ref_type == 'tag' + uses: redhat-actions/push-to-registry@v2 + id: push_image with: - image_tags: ${{ github.sha }} + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ vars.IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }} + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/build_and_push.yaml deleted file mode 100644 index 0d6c4cf..0000000 --- a/.github/workflows/build_and_push.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Build and push container image -on: - push: - tags: - - '*' - -jobs: - push-quay: - name: Build container image - runs-on: ubuntu-24.04 - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Build Image - id: build_image - uses: ./.github/actions/build-image - with: - image_tags: ${{ github.ref_name }} - - - name: Push To Registry - uses: redhat-actions/push-to-registry@v2 - id: push_image - with: - image: ${{ steps.build_image.outputs.image }} - tags: ${{ steps.build_image.outputs.tags }} - registry: ${{ vars.IMAGE_REGISTRY }}/${{ vars.IMAGE_NAMESPACE }} - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_PASSWORD }} From c71fc863b127de710a83bd8d525949585ebb268d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 19:36:51 +0000 Subject: [PATCH 5/8] Consolidate GitHub Actions workflows into a single file Consolidate the duplicated logic from `build.yaml` and `build_and_push.yaml` into a single workflow at `.github/workflows/build.yaml`. - Combined `pull_request` and `push tags` triggers. - Implemented dynamic tagging (SHA for PRs, tag name for releases). - Added conditional execution for the "Push To Registry" step. - Removed redundant workflow and actions. From def21f383c07c607d717fd9ff184ad470fcce811 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 19:43:40 +0000 Subject: [PATCH 6/8] Consolidate GitHub Actions workflows into a single file This commit merges the duplicated logic from `build.yaml` and `build_and_push.yaml` into a single, unified workflow. - Combined triggers for pull requests and tag pushes. - Implemented dynamic image tagging (SHA for PRs, ref name for tags). - Added conditional logic to the registry push step. - Removed redundant workflow files. From 9a6801c9737cc541a454831e6a1560d38351ef3d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 19:51:12 +0000 Subject: [PATCH 7/8] Consolidate GitHub Actions workflows into a single file Merged the duplicated logic from `build.yaml` and `build_and_push.yaml` into a single workflow at `.github/workflows/build.yaml`. - Combined triggers for pull requests and tag pushes. - Implemented dynamic image tagging (SHA for PRs, ref name for tags). - Added conditional logic to the registry push step. - Removed redundant workflow files. From 2b25a2a13312b4779ca7d3e867316c2c492b7a45 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 20:00:20 +0000 Subject: [PATCH 8/8] Consolidate GitHub Actions workflows into a single file Merged the duplicated logic from `build.yaml` and `build_and_push.yaml` into a single workflow at `.github/workflows/build.yaml`. - Combined triggers for pull requests and tag pushes. - Implemented dynamic image tagging (SHA for PRs, ref name for tags). - Added conditional logic to the registry push step. - Removed redundant workflow files.