From b63c035bb705a43cf8770c226c7c22e76ce199b1 Mon Sep 17 00:00:00 2001 From: Jiri Danek Date: Thu, 26 Sep 2024 12:45:09 +0200 Subject: [PATCH 1/3] RHOAIENG-9824: gha(odh-nbc): improve the GitHub Actions integration test for odh-notebook-controller to start the controller successfully and run a notebook --- ..._notebook_controller_integration_test.yaml | 200 ++++++++++++++++-- 1 file changed, 181 insertions(+), 19 deletions(-) diff --git a/.github/workflows/odh_notebook_controller_integration_test.yaml b/.github/workflows/odh_notebook_controller_integration_test.yaml index a132b8d7859..2f37bf7afd4 100644 --- a/.github/workflows/odh_notebook_controller_integration_test.yaml +++ b/.github/workflows/odh_notebook_controller_integration_test.yaml @@ -3,11 +3,12 @@ on: push: pull_request: paths: + - .github/workflows/odh_notebook_controller_integration_test.yaml + - components/notebook-controller/** - components/odh-notebook-controller/** workflow_dispatch: env: - IMG: odh-notebook-controller TAG: integration-test jobs: @@ -54,10 +55,19 @@ jobs: cache-dependency-path: components/odh-notebook-controller/go.sum - name: Build Notebook Controller Image + run: | + cd components/notebook-controller + make docker-build + env: + IMG: notebook-controller + CACHE_IMAGE: ghcr.io/${{ github.repository }}/components/notebook-controller/build-cache + + - name: Build ODH Notebook Controller Image run: | cd components/odh-notebook-controller make docker-build env: + IMG: odh-notebook-controller CACHE_IMAGE: ghcr.io/${{ github.repository }}/components/odh-notebook-controller/build-cache - name: Install KinD @@ -66,11 +76,19 @@ jobs: - name: Create KinD Cluster run: kind create cluster --config components/testing/gh-actions/kind-1-25.yaml - - name: Load Images into KinD Cluster + - name: Load image into KinD Cluster run: | - # kind load docker-image localhost/${{env.IMG}}:${{env.TAG}} - podman save -o img.tar localhost/${{env.IMG}}:${{env.TAG}} - kind load image-archive img.tar + podman save -o ${{env.IMG}}.tar localhost/${{env.IMG}}:${{env.TAG}} + kind load image-archive ${{env.IMG}}.tar + env: + IMG: notebook-controller + + - name: Load odh image into KinD Cluster + run: | + podman save -o ${{env.IMG}}.tar localhost/${{env.IMG}}:${{env.TAG}} + kind load image-archive ${{env.IMG}}.tar + env: + IMG: odh-notebook-controller - name: Install kustomize run: ./components/testing/gh-actions/install_kustomize.sh @@ -78,48 +96,192 @@ jobs: - name: Install Istio run: ./components/testing/gh-actions/install_istio.sh + - name: Install fake OpenShift CRDs + run: | + kubectl apply -f - < params.env + export CURRENT_NOTEBOOK_IMG=docker.io/kubeflownotebookswg/notebook-controller + export PR_NOTEBOOK_IMG=localhost/${{env.IMG}}:${{env.TAG}} + kustomize edit set image ${CURRENT_NOTEBOOK_IMG}=${PR_NOTEBOOK_IMG} + # configure culler cat < params.env + + cat < Date: Wed, 2 Oct 2024 11:33:56 +0200 Subject: [PATCH 2/3] Add a GitHub workflow to sync branches through PR --- .../workflows/sync-branches-through-py.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/sync-branches-through-py.yaml diff --git a/.github/workflows/sync-branches-through-py.yaml b/.github/workflows/sync-branches-through-py.yaml new file mode 100644 index 00000000000..d08ab05607f --- /dev/null +++ b/.github/workflows/sync-branches-through-py.yaml @@ -0,0 +1,47 @@ +--- +name: Sync branches through Pull Request + +on: # yamllint disable-line rule:truthy + workflow_dispatch: + inputs: + source: + description: Source branch + required: true + target: + description: Target branch + required: true + +jobs: + sync: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.target }} + fetch-depth: 0 + + - name: Prepare sync branch + id: prepare + run: | + git fetch origin ${{ github.event.inputs.source }} + git reset --hard origin/${{ github.event.inputs.source }} + + TIMESTAMP=$(date +'%Y%m%d%H%M%S') + SYNC_BRANCH=sync__${{ github.event.inputs.source }}__${{ github.event.inputs.target }}__${TIMESTAMP} + echo "branch=$SYNC_BRANCH" >> $GITHUB_OUTPUT + + - name: Create pull request + uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 + with: + branch: ${{ steps.prepare.outputs.branch }} + title: "Sync `${{ github.event.inputs.target }}` branch with `${{ github.event.inputs.source }}` branch" + body: | + :robot: This is an automated Pull Request created by `/.github/workflows/sync-branches-through-pr.yml`. + + It merges all commits from `${{ github.event.inputs.source }}` branch into `${{ github.event.inputs.target }}` branch. + + :warning: **IMPORTANT NOTE**: Remember to delete the `${{ steps.prepare.outputs.branch }}` branch after merging the changes. From e6f783d66417745364312b52653715580c030180 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 3 Oct 2024 12:39:32 +0000 Subject: [PATCH 3/3] Update odh and notebook-controller with image 1.9-fa442a1 --- .../notebook-controller/config/overlays/openshift/params.env | 2 +- components/odh-notebook-controller/Makefile | 2 +- components/odh-notebook-controller/config/base/params.env | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/notebook-controller/config/overlays/openshift/params.env b/components/notebook-controller/config/overlays/openshift/params.env index d6f49dd6c9a..4aff427b099 100644 --- a/components/notebook-controller/config/overlays/openshift/params.env +++ b/components/notebook-controller/config/overlays/openshift/params.env @@ -1 +1 @@ -odh-kf-notebook-controller-image=quay.io/opendatahub/kubeflow-notebook-controller:1.9-1769b4b +odh-kf-notebook-controller-image=quay.io/opendatahub/kubeflow-notebook-controller:1.9-fa442a1 diff --git a/components/odh-notebook-controller/Makefile b/components/odh-notebook-controller/Makefile index 558daa7a7db..345cb316724 100644 --- a/components/odh-notebook-controller/Makefile +++ b/components/odh-notebook-controller/Makefile @@ -4,7 +4,7 @@ IMG ?= quay.io/opendatahub/odh-notebook-controller TAG ?= $(shell git describe --tags --always) KF_IMG ?= quay.io/opendatahub/kubeflow-notebook-controller -KF_TAG ?= 1.9-1769b4b +KF_TAG ?= 1.9-fa442a1 CONTAINER_ENGINE ?= podman diff --git a/components/odh-notebook-controller/config/base/params.env b/components/odh-notebook-controller/config/base/params.env index 2c5e256891d..f6fda5e078f 100644 --- a/components/odh-notebook-controller/config/base/params.env +++ b/components/odh-notebook-controller/config/base/params.env @@ -1 +1 @@ -odh-notebook-controller-image=quay.io/opendatahub/odh-notebook-controller:1.9-1769b4b +odh-notebook-controller-image=quay.io/opendatahub/odh-notebook-controller:1.9-fa442a1