-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(e2e): rhidp-6297 Automate E2E Runner Image Build and Push to Qu…
…ay via GitHub Actions (#2524) * Add GitHub workflow to build and push e2e-runner image This workflow builds the e2e-runner Docker image and pushes it to Quay.io upon pull requests to the main branch. Signed-off-by: Gustavo Lira <guga.java@gmail.com> * Update README with OpenShift CI image workflow details Clarified the process for updating and deploying the `rhdh-e2e-runner` image, including workflows for `main` and other branches. Highlighted steps for local testing, GitHub Actions automation, and propagation delays in OpenShift CI's mirror Signed-off-by: Gustavo Lira <guga.java@gmail.com> --------- Signed-off-by: Gustavo Lira <guga.java@gmail.com>
- Loading branch information
1 parent
0abeaa4
commit c7ac5da
Showing
2 changed files
with
88 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build & Push e2e-runner Image to Quay.io | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- '.ibm/images/Dockerfile' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
REGISTRY: quay.io | ||
REGISTRY_IMAGE: rhdh-community/rhdh-e2e-runner | ||
IMAGE_TAG: main | ||
|
||
jobs: | ||
build-image: | ||
name: Build & Push e2e-runner Image | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-24.04] | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare Environment Variables | ||
run: | | ||
echo "PLATFORM=linux/amd64" >> $GITHUB_ENV | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Quay.io | ||
uses: docker/#-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_TOKEN }} | ||
|
||
- name: Build and Push Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: .ibm/images/ | ||
push: true | ||
tags: ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}:${{ env.IMAGE_TAG }} | ||
platforms: ${{ env.PLATFORM }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
This Dockerfile creates an image to be used by the IBM Cloud pipelines | ||
# RHDH e2e Runner - OpenShift CI Integration | ||
|
||
Currently this image is built by hand at intervals and pushed to https://quay.io/repository/rhdh-community/rhdh-e2e-runner?tab=tags when in need of an update. | ||
## Overview | ||
The `rhdh-e2e-runner` is a container image used in **OpenShift CI**, where it is deployed via a **mirror** that fetches the image from the Quay repository. | ||
|
||
``` | ||
SHA="$(git rev-parse --short=8 HEAD)" | ||
# main or release-1.y | ||
branch="$(git rev-parse --abbrev-ref HEAD)" | ||
image="quay.io/rhdh-community/rhdh-e2e-runner:${branch}" | ||
## Workflow for Updating the Image | ||
|
||
# build and push | ||
podman build . -f Dockerfile -t "${image}-${SHA}" && podman push "${image}-${SHA}" | ||
### **Main Branch Workflow** | ||
For changes to the image in `.ibm/images/Dockerfile`, follow these steps: | ||
1. **Perform a Local Test:** | ||
- Before updating the `Dockerfile`, perform a local test by running the e2e tests to ensure the changes are stable. | ||
|
||
# update the floating (branch-named) tag too | ||
skopeo --insecure-policy copy --all docker://${image}-${SHA} docker://${image} | ||
``` | ||
2. **Update the Dockerfile:** | ||
- Once validated, update `.ibm/images/Dockerfile` with the required changes. | ||
|
||
In future this might be automated so that if the contents of this folder changes, a new image is pushed automatically. | ||
3. **GitHub Actions Build & Push:** | ||
- The **GitHub Actions workflow** automatically builds and pushes the updated image to **Quay.io**. | ||
- This only happens **after all tests are completed successfully**. | ||
|
||
See also: | ||
4. **Propagation to OpenShift CI Mirror:** | ||
- After the image is pushed to Quay, OpenShift CI **does not** immediately use the new image. | ||
- There is a delay while OpenShift updates its **mirror** with the new version. | ||
|
||
* https://quay.io/repository/rhdh-community/rhdh-e2e-runner?tab=info | ||
* https://issues.redhat.com/browse/RHIDP-6244 | ||
5. **Merge to Main Branch:** | ||
- The image update process happens **before merging into `main`**. | ||
- Ensure that the updated image has been successfully used in e2e tests before merging. | ||
|
||
### **Other Branches Workflow** | ||
For branches **other than `main`**, OpenShift CI does **not** fetch from Quay: | ||
- Instead, **OpenShift CI builds the image directly** from `.ibm/images/Dockerfile`. | ||
- Any changes made to the file will **immediately reflect** in the test execution. | ||
- There is no need to wait for an image update in the mirror. | ||
|
||
## Key Considerations | ||
- **Local testing is mandatory** before making any modifications. | ||
- **GitHub Actions automates the push process** only for `main` branch updates. | ||
- **OpenShift CI mirror has a delay** in updating the image after it is pushed to Quay. | ||
- **Other branches build the image directly**, so changes take effect immediately. |