From 548db5d6d3fe287f44d384ecf5786310029920ee Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Fri, 7 Mar 2025 09:51:06 +0530 Subject: [PATCH 1/8] First commit for upgrade Signed-off-by: M Sajid Mansoori --- .github/workflows/upgrade-ci.yml | 124 +++++++++++++++++++++++++++++++ hack/create-index-image.sh | 18 +++++ hack/upgrade-konveyor.sh | 0 3 files changed, 142 insertions(+) create mode 100644 .github/workflows/upgrade-ci.yml create mode 100755 hack/create-index-image.sh create mode 100644 hack/upgrade-konveyor.sh diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml new file mode 100644 index 000000000..e0ff491bf --- /dev/null +++ b/.github/workflows/upgrade-ci.yml @@ -0,0 +1,124 @@ +name: Upgrade CI test + +on: + # pull_request: + # branches: + # - main + push: # Runs on any direct push to any branch + + +jobs: + k8s: + runs-on: ubuntu-latest + steps: + - name: Checkout tackle + uses: actions/checkout@v2 + with: + repository: konveyor/tackle + path: tackle + + - name: Checkout to branch + uses: actions/checkout@v2 + + - name: Install operator-sdk + shell: bash + run: | + if command -v operator-sdk >/dev/null 2>&1; then + echo "operator-sdk is already installed...yay" + exit 0 + fi + curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.35.0/operator-sdk_linux_amd64 + sudo install -o root -g root -m 0755 operator-sdk_linux_amd64 /usr/local/bin/operator-sdk + + - name: Install kubectl + shell: bash + run: | + if command -v kubectl >/dev/null 2>&1; then + echo "kubectl is already installed...yay" + exit 0 + fi + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + + - name: Install opm cli + shell: bash + run: | + if command -v opm >/dev/null 2>&1; then + echo "opm is already installed" + exit 0 + fi + export OPM_VERSION=$(curl -s https://api.github.com/repos/operator-framework/operator-registry/releases/latest | grep tag_name | cut -d '"' -f 4) + + # Download the binary + curl -Lo opm-linux-amd64 "https://github.com/operator-framework/operator-registry/releases/download/${OPM_VERSION}/linux-amd64-opm" + chmod +x opm-linux-amd64 + sudo mv opm-linux-amd64 /usr/local/bin/opm + opm version + + - name: Set Environment Variables + run: | + echo "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }}" >> $GITHUB_ENV + echo "QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }}" >> $GITHUB_ENV + + - name: Create and push index image to quay + run: bash hack/create-index-image.sh + + - name: Setup minikube + uses: konveyor/tackle2-operator/.github/actions/start-minikube@main + with: + memory: 'max' + cpus: 'max' + + - name: Enable olm + run: minikube addons enable olm + + - name: Enable ingress addon + run : minikube addons enable ingress + + + + # - name: Install konveyor + # uses: konveyor/tackle2-operator/.github/actions/install-konveyor@main + # with: + # tackle_cr: '{"kind":"Tackle","apiVersion":"tackle.konveyor.io/v1alpha1","metadata":{"name":"tackle"},"spec":{"image_pull_policy":"IfNotPresent","feature_auth_required":true}}' + + # - name: Wait for pods to be ready. + # run: sleep 150s + # shell: bash + + # - name: Check pod status + # run: kubectl get pods -n konveyor-tackle + + # - name: Wait for Ingress + # shell: bash + # run: | + # bash -c 'external_ip=""; + # echo $external_ip; + # while [[ -z $external_ip ]] + # do + # echo "Waiting for end point..." + # external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] && + # echo $external_ip; + # sleep 10; + # done + # echo "End point ready:" && + # echo $external_ip; + # export endpoint=$(minikube ip); + # echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV' + + # - name: Checkout to branch + # uses: actions/checkout@v2 + + # - name: Install NPM + # run: npm install . + # - name: Run cypress login test + # run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="password",tackleUrl=${{ env.CYPRESS_tackleUrl }} + # - name: Run Tier0 test cases + # run: | + # CYPRESS_INCLUDE_TAGS=@ci npx cypress run --spec **/*.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} + + # - uses: actions/upload-artifact@v4 + # if: failure() + # with: + # name: minikube-tests-screenshots + # path: tackle-ui-tests/cypress/screenshots diff --git a/hack/create-index-image.sh b/hack/create-index-image.sh new file mode 100755 index 000000000..09d21a779 --- /dev/null +++ b/hack/create-index-image.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -E +set -e +set -x +set -o pipefail + +SOURCE_UPGRADE_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:v0.6.0}" +TARGET_UPGRADE_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:latest}" + +echo 'Creating bundle image using $SOURCE_UPGRADE_BUNDLE_IMAGE and $TARGET_UPGRADE_BUNDLE_IMAGE' + +opm index add --bundles "${SOURCE_UPGRADE_BUNDLE_IMAGE}","${TARGET_UPGRADE_BUNDLE_IMAGE}" --tag quay.io/migqe/tackle2-operator-upgrade-index:latest + +podman images + +podman login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io +podman push quay.io/migqe/tackle2-operator-upgrade-index:latest diff --git a/hack/upgrade-konveyor.sh b/hack/upgrade-konveyor.sh new file mode 100644 index 000000000..e69de29bb From 33cfefa5a24c1ae87fe6e57e6667a03b73d8cc04 Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Fri, 7 Mar 2025 11:01:58 +0530 Subject: [PATCH 2/8] Add templates for konveyor install Signed-off-by: M Sajid Mansoori --- .github/workflows/upgrade-ci.yml | 3 ++- hack/create-index-image.sh | 4 +++- hack/install-preupgrade-konveyor.sh | 34 +++++++++++++++++++++++++++++ hack/templates/01_namespace.sh | 6 +++++ hack/templates/02_catsrc.sh | 15 +++++++++++++ hack/templates/03_operatorgroup.sh | 10 +++++++++ hack/templates/04_subscription.sh | 13 +++++++++++ hack/templates/05_tacklecr.sh | 9 ++++++++ hack/upgrade-konveyor.sh | 0 9 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 hack/install-preupgrade-konveyor.sh create mode 100755 hack/templates/01_namespace.sh create mode 100644 hack/templates/02_catsrc.sh create mode 100644 hack/templates/03_operatorgroup.sh create mode 100644 hack/templates/04_subscription.sh create mode 100644 hack/templates/05_tacklecr.sh delete mode 100644 hack/upgrade-konveyor.sh diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml index e0ff491bf..7e1f7c512 100644 --- a/.github/workflows/upgrade-ci.yml +++ b/.github/workflows/upgrade-ci.yml @@ -75,7 +75,8 @@ jobs: - name: Enable ingress addon run : minikube addons enable ingress - + - name: Upgrade konveyor + run: bash hack/install-preupgrade-konveyor.sh # - name: Install konveyor # uses: konveyor/tackle2-operator/.github/actions/install-konveyor@main diff --git a/hack/create-index-image.sh b/hack/create-index-image.sh index 09d21a779..96b477b05 100755 --- a/hack/create-index-image.sh +++ b/hack/create-index-image.sh @@ -15,4 +15,6 @@ opm index add --bundles "${SOURCE_UPGRADE_BUNDLE_IMAGE}","${TARGET_UPGRADE_BUNDL podman images podman login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io -podman push quay.io/migqe/tackle2-operator-upgrade-index:latest +podman push quay.io/migqe/tackle2-operator-upgrade-index:latest #To do , maybe change the tag from latest to the source/target versions. + +echo 'Image pushed succesfully' diff --git a/hack/install-preupgrade-konveyor.sh b/hack/install-preupgrade-konveyor.sh new file mode 100644 index 000000000..0471ea748 --- /dev/null +++ b/hack/install-preupgrade-konveyor.sh @@ -0,0 +1,34 @@ +NAMESPACE="${NAMESPACE:-konveyor-tackle}" +TEMPLATE_DIR="${TEMPLATE_DIR:-hack/templates}" +KONVEYOR_UPGRADE_INDEX="${KONVEYOR_UPGRADE_INDEX:-quay.io/migqe/tackle2-operator-upgrade-index:latest}" +SUBSCRIPTION_CHANNEL="${SUBSCRIPTION_CHANNEL:-konveyor-0.6}" +PREUPGRADE_VERSION="${PREUPGRADE_VERSION:-0.6.0}" +POSTUPGRADE_VERSION="${POSTUPGRADE_VERSION:-99.0.0}" #Always the latest from main. +echo "Creating namespace" +echo "${SUBSCRIPTION_CHANNEL}" +source "${TEMPLATE_DIR}/01_namespace.sh" + +source "${TEMPLATE_DIR}/02_catsrc.sh" + +source "${TEMPLATE_DIR}/03_operatorgroup.sh" + +source "${TEMPLATE_DIR}/04_subscription.sh" + +kubectl get sub -n konveyor-tackle -o yaml #Remove later + +sleep 60s +echo "Patching installplan for konveyor..." + +kubectl get ip -n "${NAMESPACE}" + +kubectl patch ip $(kubectl get ip -n "${NAMESPACE}" | egrep "$PREUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' + +sleep 20s + +source "${TEMPLATE_DIR}/05_tacklecr.sh" + +kubectl wait --namespace "${NAMESPACE}" --for=condition=Successful --timeout=600s tackles.tackle.konveyor.io/tackle +kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" --timeout=300s +sleep 120s + +kubectl get po -n "${NAMESPACE}" diff --git a/hack/templates/01_namespace.sh b/hack/templates/01_namespace.sh new file mode 100755 index 000000000..efc205391 --- /dev/null +++ b/hack/templates/01_namespace.sh @@ -0,0 +1,6 @@ +cat < Date: Fri, 7 Mar 2025 15:15:20 +0530 Subject: [PATCH 3/8] Test preupgrade tests Signed-off-by: M Sajid Mansoori --- .github/workflows/upgrade-ci.yml | 110 ++++++++++++++++----------- hack/install-postupgrade-konveyor.sh | 48 ++++++++++++ hack/install-preupgrade-konveyor.sh | 2 + 3 files changed, 114 insertions(+), 46 deletions(-) create mode 100644 hack/install-postupgrade-konveyor.sh diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml index 7e1f7c512..e7b4d74a8 100644 --- a/.github/workflows/upgrade-ci.yml +++ b/.github/workflows/upgrade-ci.yml @@ -18,7 +18,10 @@ jobs: path: tackle - name: Checkout to branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 + + - name: Get Initial Branch Name + run: echo "INIT_BRANCH=$(git symbolic-ref --short HEAD)" >> $GITHUB_ENV - name: Install operator-sdk shell: bash @@ -75,51 +78,66 @@ jobs: - name: Enable ingress addon run : minikube addons enable ingress - - name: Upgrade konveyor + - name: Install Pre Upgrade konveyor run: bash hack/install-preupgrade-konveyor.sh - # - name: Install konveyor - # uses: konveyor/tackle2-operator/.github/actions/install-konveyor@main - # with: - # tackle_cr: '{"kind":"Tackle","apiVersion":"tackle.konveyor.io/v1alpha1","metadata":{"name":"tackle"},"spec":{"image_pull_policy":"IfNotPresent","feature_auth_required":true}}' + + - name: Check pod status + run: kubectl get pods -n konveyor-tackle + + - name: Wait for Ingress + shell: bash + run: | + bash -c 'external_ip=""; + echo $external_ip; + while [[ -z $external_ip ]] + do + echo "Waiting for end point..." + external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] && + echo $external_ip; + sleep 10; + done + echo "End point ready:" && + echo $external_ip; + export endpoint=$(minikube ip); + echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV' + git branch + + - name: Checkout to release-0.6 branch + uses: actions/checkout@v4 + with: + ref: release-0.6 + + - name: Install NPM + run: npm install . + + - name: Run cypress login test + run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="password",tackleUrl=${{ env.CYPRESS_tackleUrl }} + + - name: Run Preupgrade test cases + run: | + CYPRESS_INCLUDE_TAGS=@pre-upgrade npx cypress run --spec **/*.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} + + - name: Checkout to initial branch + run: git checkout $INIT_BRANCH + - # - name: Wait for pods to be ready. - # run: sleep 150s - # shell: bash - - # - name: Check pod status - # run: kubectl get pods -n konveyor-tackle - - # - name: Wait for Ingress - # shell: bash - # run: | - # bash -c 'external_ip=""; - # echo $external_ip; - # while [[ -z $external_ip ]] - # do - # echo "Waiting for end point..." - # external_ip=$(kubectl get ingress tackle --template="{{range.status.loadBalancer.ingress}}{{.ip}}{{end}}" -n konveyor-tackle);[[ -z $external_ip ]] && - # echo $external_ip; - # sleep 10; - # done - # echo "End point ready:" && - # echo $external_ip; - # export endpoint=$(minikube ip); - # echo "CYPRESS_tackleUrl=https://$endpoint" >>$GITHUB_ENV' - - # - name: Checkout to branch - # uses: actions/checkout@v2 - - # - name: Install NPM - # run: npm install . - # - name: Run cypress login test - # run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="password",tackleUrl=${{ env.CYPRESS_tackleUrl }} - # - name: Run Tier0 test cases - # run: | - # CYPRESS_INCLUDE_TAGS=@ci npx cypress run --spec **/*.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} - - # - uses: actions/upload-artifact@v4 - # if: failure() - # with: - # name: minikube-tests-screenshots - # path: tackle-ui-tests/cypress/screenshots + - name: Install Post Upgrade konveyor + run: git branch && bash hack/install-postupgrade-konveyor.sh + + + - name: Install NPM + run: npm install . + + - name: Run cypress login test + run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="Dog8code",tackleUrl=${{ env.CYPRESS_tackleUrl }} + + - name: Run Post upgrade test cases + run: | + CYPRESS_INCLUDE_TAGS=@post-upgrade npx cypress run --spec **/*.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: minikube-tests-screenshots + path: tackle-ui-tests/cypress/screenshots diff --git a/hack/install-postupgrade-konveyor.sh b/hack/install-postupgrade-konveyor.sh new file mode 100644 index 000000000..d1e334028 --- /dev/null +++ b/hack/install-postupgrade-konveyor.sh @@ -0,0 +1,48 @@ +NAMESPACE="${NAMESPACE:-konveyor-tackle}" +TEMPLATE_DIR="${TEMPLATE_DIR:-hack/templates}" +KONVEYOR_UPGRADE_INDEX="${KONVEYOR_UPGRADE_INDEX:-quay.io/migqe/tackle2-operator-upgrade-index:latest}" +SUBSCRIPTION_CHANNEL="${SUBSCRIPTION_CHANNEL:-development}" +PREUPGRADE_VERSION="${PREUPGRADE_VERSION:-0.6.0}" +POSTUPGRADE_VERSION="${POSTUPGRADE_VERSION:-99.0.0}" #Always the latest from main. +TIMEOUT=300 # Maximum wait time in seconds (5 minutes) +INTERVAL=10 # Time to wait between checks (10 seconds) +ELAPSED=0 + + +echo "Patch subscription channel to ${SUBSCRIPTION_CHANNEL}" +kubectl patch sub konveyor-operator -n konveyor-tackle --type=merge -p "{\"spec\":{\"channel\":\"${SUBSCRIPTION_CHANNEL}\"}}" + +echo "Patching installplan for konveyor..." + +kubectl patch ip $(kubectl get ip -n "${NAMESPACE}" | egrep "$POSTUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' + +kubectl wait --namespace "${NAMESPACE}" --for=condition=Successful --timeout=600s tackles.tackle.konveyor.io/tackle + +kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" --timeout=300s + +echo "Waiting for UI pod to be replaced after upgrade..." +echo "Previous UI Pod: $PREUPGRADE_UI_POD" + +while true; do + # Get the current UI pod name + UI_POD_AFTER=$(kubectl get pods -n "${NAMESPACE}" -l app.kubernetes.io/name=tackle-ui -o name) + + # Check if the pod has changed + if [[ "$PREUPGRADE_UI_POD" != "$UI_POD_AFTER" ]]; then + echo "UI pod has changed! New pod: $UI_POD_AFTER" + break + fi + + # Check if timeout is reached + if [[ "$ELAPSED" -ge "$TIMEOUT" ]]; then + echo "Timeout reached! Pod did not change within $TIMEOUT seconds." + exit 1 # Fail the script if pod did not bounce + fi + + echo "Pod has not changed yet. Retrying in $INTERVAL seconds..." + sleep $INTERVAL + ((ELAPSED+=INTERVAL)) +done +sleep 200s + +kubectl get po -n "${NAMESPACE}" diff --git a/hack/install-preupgrade-konveyor.sh b/hack/install-preupgrade-konveyor.sh index 0471ea748..3dfc7538b 100644 --- a/hack/install-preupgrade-konveyor.sh +++ b/hack/install-preupgrade-konveyor.sh @@ -29,6 +29,8 @@ source "${TEMPLATE_DIR}/05_tacklecr.sh" kubectl wait --namespace "${NAMESPACE}" --for=condition=Successful --timeout=600s tackles.tackle.konveyor.io/tackle kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" --timeout=300s +PREUPGRADE_UI_POD=$(kubectl get pod -l app.kubernetes.io/name=tackle-ui -n "${NAMESPACE}" -o name) +echo "PREUPGRADE_UI_POD=$PREUPGRADE_UI_POD" >> $GITHUB_ENV sleep 120s kubectl get po -n "${NAMESPACE}" From 93b1480b7f0adfbb40d50724429f23136605d7ec Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Wed, 25 Jun 2025 15:33:02 +0530 Subject: [PATCH 4/8] Add mtaVersion env variable for tests --- .github/workflows/upgrade-ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml index e7b4d74a8..94f800a32 100644 --- a/.github/workflows/upgrade-ci.yml +++ b/.github/workflows/upgrade-ci.yml @@ -81,6 +81,15 @@ jobs: - name: Install Pre Upgrade konveyor run: bash hack/install-preupgrade-konveyor.sh + - name: Set preupgrade konveyor value + run: | + kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version + konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version) + echo $konveyor_version + echo "mtaVersion=$konveyor_version" >> $GITHUB_ENV + + - name: Use mtaVersion + run: echo "Konveyor version is $mtaVersion" - name: Check pod status run: kubectl get pods -n konveyor-tackle @@ -129,6 +138,16 @@ jobs: - name: Install NPM run: npm install . + + - name: Set postupgrade konveyor value + run: | + konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version) + echo "mtaVersion=$konveyor_version" >> $GITHUB_ENV + + - name: Use mtaVersion + run: echo "Konveyor version is $mtaVersion" + + - name: Run cypress login test run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="Dog8code",tackleUrl=${{ env.CYPRESS_tackleUrl }} From 480d5eb9f8d70fe378eb7d61bd150ec5b3a50766 Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Wed, 25 Jun 2025 16:29:49 +0530 Subject: [PATCH 5/8] installplan --- hack/install-preupgrade-konveyor.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/install-preupgrade-konveyor.sh b/hack/install-preupgrade-konveyor.sh index 3dfc7538b..f6fdd92c6 100644 --- a/hack/install-preupgrade-konveyor.sh +++ b/hack/install-preupgrade-konveyor.sh @@ -19,9 +19,9 @@ kubectl get sub -n konveyor-tackle -o yaml #Remove later sleep 60s echo "Patching installplan for konveyor..." -kubectl get ip -n "${NAMESPACE}" +kubectl get installplan -n "${NAMESPACE}" -kubectl patch ip $(kubectl get ip -n "${NAMESPACE}" | egrep "$PREUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' +kubectl patch installplan $(kubectl get installplan -n "${NAMESPACE}" | egrep "$PREUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' sleep 20s From c8baf28af5158d0c9d57b342eddf51231b3ae47d Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Thu, 26 Jun 2025 10:30:28 +0530 Subject: [PATCH 6/8] Test env --- .github/workflows/upgrade-ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml index 94f800a32..e1e4bba70 100644 --- a/.github/workflows/upgrade-ci.yml +++ b/.github/workflows/upgrade-ci.yml @@ -83,9 +83,7 @@ jobs: - name: Set preupgrade konveyor value run: | - kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version - konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version) - echo $konveyor_version + konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version | head -n 1 | tr -d '[:space:]') echo "mtaVersion=$konveyor_version" >> $GITHUB_ENV - name: Use mtaVersion @@ -125,7 +123,7 @@ jobs: - name: Run Preupgrade test cases run: | - CYPRESS_INCLUDE_TAGS=@pre-upgrade npx cypress run --spec **/*.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} + CYPRESS_INCLUDE_TAGS=@pre-upgrade npx cypress run --spec cypress/e2e/tests/upgrade/create_upgrade_data.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} - name: Checkout to initial branch run: git checkout $INIT_BRANCH @@ -141,7 +139,7 @@ jobs: - name: Set postupgrade konveyor value run: | - konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version) + konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version | head -n 1 | tr -d '[:space:]') echo "mtaVersion=$konveyor_version" >> $GITHUB_ENV - name: Use mtaVersion @@ -159,4 +157,4 @@ jobs: if: failure() with: name: minikube-tests-screenshots - path: tackle-ui-tests/cypress/screenshots + path: tackle-ui-tests/cypress/screenshots From 07755505d5f17d5a11e8b31475bdbbc877ffb28c Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Mon, 7 Jul 2025 14:32:29 +0530 Subject: [PATCH 7/8] Test Signed-off-by: M Sajid Mansoori --- .github/workflows/upgrade-ci.yml | 56 +++++++++++++++++++++++----- hack/install-postupgrade-konveyor.sh | 2 +- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml index e1e4bba70..848a2dbd9 100644 --- a/.github/workflows/upgrade-ci.yml +++ b/.github/workflows/upgrade-ci.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout tackle - uses: actions/checkout@v2 + uses: actions/checkout@v2 with: repository: konveyor/tackle path: tackle @@ -42,6 +42,18 @@ jobs: fi curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + - name: Installing oc binary + shell: bash + run: | + if command -v oc >/dev/null 2>&1; then + echo "oc is already installed...yay" + exit 0 + fi + OC_VERSION=$(curl -s https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/release.txt | grep 'Name:' | awk '{print $2}') + curl -LO "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${OC_VERSION}/openshift-client-linux.tar.gz" + tar -xzf openshift-client-linux.tar.gz oc + sudo mv oc /usr/local/bin/oc + oc version --client - name: Install opm cli shell: bash @@ -83,11 +95,19 @@ jobs: - name: Set preupgrade konveyor value run: | - konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version | head -n 1 | tr -d '[:space:]') - echo "mtaVersion=$konveyor_version" >> $GITHUB_ENV + konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version | head -n 2 | tr -d '[:space:]') + echo "cypress_mtaVersion=$konveyor_version" >> $GITHUB_ENV + echo "Konveyor version: $konveyor_version" + + - name: Display konveyor version for confirmation + run: | + echo "Confirming konveyor version from environment variable: $cypress_mtaVersion" + echo "Environment variable cypress_mtaVersion value: ${{ env.cypress_mtaVersion }}" - name: Use mtaVersion - run: echo "Konveyor version is $mtaVersion" + run: echo "Konveyor version is $cypress_mtaVersion" + + - name: Check pod status run: kubectl get pods -n konveyor-tackle @@ -118,12 +138,23 @@ jobs: - name: Install NPM run: npm install . + - name: Set Keycloak admin password and git credentials + run: | + keycloak_password=$(kubectl get secret tackle-keycloak-sso -n konveyor-tackle -o=jsonpath='{.data.admin-password}' | base64 -d) + echo "cypress_keycloakAdminPassword=$keycloak_password" >> $GITHUB_ENV + - name: Run cypress login test run: npx cypress run --spec "cypress/e2e/tests/login.test.ts" --env user="admin",pass="password",tackleUrl=${{ env.CYPRESS_tackleUrl }} - name: Run Preupgrade test cases run: | - CYPRESS_INCLUDE_TAGS=@pre-upgrade npx cypress run --spec cypress/e2e/tests/upgrade/create_upgrade_data.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} + CYPRESS_INCLUDE_TAGS=@pre-upgrade npx cypress run --spec cypress/e2e/tests/upgrade/create_upgrade_data.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }},git_user=${{ secrets.KONVEYOR_GIT_USER }},git_password=${{ secrets.KONVEYOR_GIT_PASSWORD }} + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: minikube-tests-screenshots + path: /home/runner/work/tackle-ui-tests/tackle-ui-tests/cypress/screenshots/ - name: Checkout to initial branch run: git checkout $INIT_BRANCH @@ -139,11 +170,16 @@ jobs: - name: Set postupgrade konveyor value run: | - konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version | head -n 1 | tr -d '[:space:]') - echo "mtaVersion=$konveyor_version" >> $GITHUB_ENV + konveyor_version=$(kubectl get csv -n konveyor-tackle -o=custom-columns=:spec.version | head -n 2 | tr -d '[:space:]') + echo "cypress_mtaVersion=$konveyor_version" >> $GITHUB_ENV + + - name: Set Keycloak admin password and git credentials (post-upgrade) + run: | + keycloak_password=$(kubectl get secret tackle-keycloak-sso -n konveyor-tackle -o=jsonpath='{.data.admin-password}' | base64 -d) + echo "cypress_keycloakAdminPassword=$keycloak_password" >> $GITHUB_ENV - name: Use mtaVersion - run: echo "Konveyor version is $mtaVersion" + run: echo "Konveyor version is $cypress_mtaVersion" - name: Run cypress login test @@ -151,10 +187,10 @@ jobs: - name: Run Post upgrade test cases run: | - CYPRESS_INCLUDE_TAGS=@post-upgrade npx cypress run --spec **/*.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }} + CYPRESS_INCLUDE_TAGS=@post-upgrade npx cypress run --spec cypress/e2e/tests/upgrade/after_upgrade.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }},git_user=${{ secrets.KONVEYOR_GIT_USER }},git_password=${{ secrets.KONVEYOR_GIT_PASSWORD }} - uses: actions/upload-artifact@v4 if: failure() with: name: minikube-tests-screenshots - path: tackle-ui-tests/cypress/screenshots + path: /home/runner/work/tackle-ui-tests/tackle-ui-tests/cypress/screenshots/ diff --git a/hack/install-postupgrade-konveyor.sh b/hack/install-postupgrade-konveyor.sh index d1e334028..19e94ef03 100644 --- a/hack/install-postupgrade-konveyor.sh +++ b/hack/install-postupgrade-konveyor.sh @@ -14,7 +14,7 @@ kubectl patch sub konveyor-operator -n konveyor-tackle --type=merge -p "{\"spec\ echo "Patching installplan for konveyor..." -kubectl patch ip $(kubectl get ip -n "${NAMESPACE}" | egrep "$POSTUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' +kubectl patch installplan $(kubectl get installplan -n "${NAMESPACE}" | egrep "$POSTUPGRADE_VERSION"|awk '{print $1}') -n "${NAMESPACE}" --type merge --patch '{"spec":{"approved":true}}' kubectl wait --namespace "${NAMESPACE}" --for=condition=Successful --timeout=600s tackles.tackle.konveyor.io/tackle From ab6e2be65cf3828f15df204cd04574215029ed38 Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Wed, 23 Jul 2025 13:55:40 +0530 Subject: [PATCH 8/8] Use baseUrl Signed-off-by: M Sajid Mansoori --- .github/workflows/upgrade-ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upgrade-ci.yml b/.github/workflows/upgrade-ci.yml index 848a2dbd9..f1333a941 100644 --- a/.github/workflows/upgrade-ci.yml +++ b/.github/workflows/upgrade-ci.yml @@ -187,10 +187,12 @@ jobs: - name: Run Post upgrade test cases run: | - CYPRESS_INCLUDE_TAGS=@post-upgrade npx cypress run --spec cypress/e2e/tests/upgrade/after_upgrade.test.ts --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }},git_user=${{ secrets.KONVEYOR_GIT_USER }},git_password=${{ secrets.KONVEYOR_GIT_PASSWORD }} + CYPRESS_INCLUDE_TAGS=@post-upgrade npx cypress run --spec cypress/e2e/tests/upgrade/after_upgrade.test.ts --config baseUrl=${{ env.CYPRESS_tackleUrl }} --env user=admin,pass=Dog8code,tackleUrl=${{ env.CYPRESS_tackleUrl }},git_user=${{ secrets.KONVEYOR_GIT_USER }},git_password=${{ secrets.KONVEYOR_GIT_PASSWORD }} - uses: actions/upload-artifact@v4 if: failure() with: name: minikube-tests-screenshots path: /home/runner/work/tackle-ui-tests/tackle-ui-tests/cypress/screenshots/ + + \ No newline at end of file