From 438b16100d8476c867b1826f33ece05ada02d7b2 Mon Sep 17 00:00:00 2001 From: gabriel-farache Date: Wed, 9 Oct 2024 23:25:10 +0200 Subject: [PATCH] Update CIs (#449) Signed-off-by: gabriel-farache --- .github/workflows/m2k-func.yaml | 2 +- .github/workflows/main.yml | 2 +- .github/workflows/mta-e2e.yaml | 173 ------------------ .github/workflows/mta-v6.x-e2e.yaml | 165 ----------------- .github/workflows/mta-v6.x.yml | 19 -- Makefile | 1 - e2e/mta-v6.x.sh | 49 ----- experimental-e2e-tests-on-ubuntu-vm/mta-v6.sh | 56 ------ experimental-e2e-tests-on-ubuntu-vm/readme.md | 8 +- 9 files changed, 6 insertions(+), 469 deletions(-) delete mode 100644 .github/workflows/mta-e2e.yaml delete mode 100644 .github/workflows/mta-v6.x-e2e.yaml delete mode 100644 .github/workflows/mta-v6.x.yml delete mode 100755 e2e/mta-v6.x.sh delete mode 100755 experimental-e2e-tests-on-ubuntu-vm/mta-v6.sh diff --git a/.github/workflows/m2k-func.yaml b/.github/workflows/m2k-func.yaml index b6d0507c..a21d794f 100644 --- a/.github/workflows/m2k-func.yaml +++ b/.github/workflows/m2k-func.yaml @@ -91,7 +91,7 @@ jobs: cd config-repo git switch -c m2k-kfunc-autopr-$RANDOM - ./hack/bump_chart_version.sh move2kube --bump-patch-version + ./hack/bump_chart_version.sh move2kube --bump-tag-version yq --inplace '.kfunction.image="quay.io/orchestrator/serverless-workflow-m2k-kfunc:${{ github.sha }}"' charts/move2kube/values.yaml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 137285df..16426f59 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -118,7 +118,7 @@ jobs: cd config-repo git switch -c ${{ inputs.workflow_id }}-autopr-$RANDOM - ./hack/bump_chart_version.sh ${{ inputs.workflow_id }} --bump-patch-version + ./hack/bump_chart_version.sh ${{ inputs.workflow_id }} --bump-tag-version mkdir -p charts/${{ inputs.workflow_id }}/templates cp ${WORKDIR}/${{ inputs.workflow_id }}/manifests/* charts/${{ inputs.workflow_id }}/templates diff --git a/.github/workflows/mta-e2e.yaml b/.github/workflows/mta-e2e.yaml deleted file mode 100644 index 6ef21a94..00000000 --- a/.github/workflows/mta-e2e.yaml +++ /dev/null @@ -1,173 +0,0 @@ -name: MTA Workflow end to end tests - -on: - workflow_dispatch: - pull_request: - branches: - - main - paths: - - 'mta/**' - - 'pipeline/**' - - 'e2e/mta.sh' - - '!mta/*.svg' - - .github/workflows/mta-e2e.yaml - - .github/workflows/main.yml - -jobs: - build: - uses: ./.github/workflows/main.yml - secrets: inherit - with: - workflow_id: mta - it_mode: true - run-e2e: - runs-on: ubuntu-24.04 - needs: build - steps: - - uses: actions/checkout@v4 - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.10.0 - with: - cluster_name: kind - - name: Install Konveyor 0.2 (MTA upstream equivalent to 6.2) - run: | - kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml - # give the apiserver time - sleep 5s - kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml - - # install konveyor operator - # version 0.2 is MTA 6.2 and 0.3 is 7.x - kubectl create -f https://operatorhub.io/install/konveyor-0.2/konveyor-operator.yaml - # give the apiserver time - echo "sleeping 120 seconds to give time for the operator to pull images and start" - sleep 120s - kubectl get csv -A - # TODO its a bit smelly that the csv name is coded here. - kubectl wait --for=jsonpath='{.status.phase}=Succeeded' -n my-konveyor-operator csv/konveyor-operator.v0.2.1 - kubectl get pods -A - kubectl wait --for=condition=Ready=true pods -l "name=tackle-operator" -n my-konveyor-operator --timeout=120s - kubectl get crds - kubectl create -f - << EOF - kind: Tackle - apiVersion: tackle.konveyor.io/v1alpha1 - metadata: - name: tackle - namespace: my-konveyor-operator - spec: - feature_auth_required: false - hub_database_volume_size: 1Gi - hub_bucket_volume_size: 1Gi - EOF - - kubectl get pods -n my-konveyor-operator - sleep 60s - kubectl get tackle -n my-konveyor-operator -o yaml - echo "wait for tackle ui to be ready" - kubectl get pods -n my-konveyor-operator - sleep 30s - kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=tackle-ui" -n my-konveyor-operator --timeout=120s - # now MTA workflow can execute agains tackle-ui.my-konveyor-operator.svc:8080 - - - name: Deploy Orchestrator-k8s helm chart - run: | - helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart - helm install orchestrator orchestrator/orchestrator-k8s - - kubectl get sfp -A - kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=10m - kubectl get pods -o wide - kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=120s - #give the data-index time to register and start. - sleep 1m - kubectl get pods - kubectl get svc - - - name: Deploy psql - run: | - kubectl create secret generic sonataflow-psql-postgresql --from-literal=postgres-username=postgres --from-literal=postgres-password=postgres - helm repo add bitnami https://charts.bitnami.com/bitnami - helm install sonataflow-psql bitnami/postgresql --version 12.12.10 \ - -f https://raw.githubusercontent.com/parodos-dev/orchestrator-helm-chart/main/postgresql/values.yaml - - - name: Download sonataflow artifacts generated manifests - uses: actions/download-artifact@v4 - with: - name: serverless-workflow-mta-manifests - path: manifests - - - name: Download serverless workflows mta image - uses: actions/download-artifact@v4 - with: - name: serverless-workflow-mta-${{ github.sha }}.tar - - - name: Load mta workflow image to Kind - run: | - kind load image-archive serverless-workflow-mta-${{ github.sha }}.tar - - - - name: Deploy MTA serverless workflow - run: | - # Set the endpoint to the tackle-ui service - yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080/hub"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://orchestrator-backstage.default.svc.cluster.local:7007/"}] )' manifests/0?-sonataflow_mtaanalysis.yaml - - # reuse orchestrator psql persistence for e2e tests - kubectl patch secret orchestrator-postgresql --patch='{"stringData": { "postgres-username": "postgres" }}' - - yq --inplace ".spec.persistence = ( - { - \"postgresql\": { - \"secretRef\": { - \"name\": \"orchestrator-postgresql\", - \"userKey\": \"postgres-username\", - \"passwordKey\": \"postgres-password\" - }, - \"serviceRef\": { - \"name\": \"orchestrator-postgresql\", - \"port\": 5432, - \"databaseName\": \"postgres\", - \"databaseSchema\": \"mta\" - } - } - } - )" manifests/0?-sonataflow_mtaanalysis.yaml - - echo "manifests/02-configmap_mtaanalysis-props.yaml" - cat manifests/0?-configmap_mtaanalysis-props.yaml - echo "---" - - echo "manifests/0?-sonataflow_mtaanalysis.yaml" - cat manifests/0?-sonataflow_mtaanalysis.yaml - echo "---" - - # Set notification external access token - echo " Set notification external access token" - BACKEND_SECRET=$(kubectl get secret orchestrator-auth -o jsonpath={.data.backend-secret}) - yq --inplace ".data.NOTIFICATIONS_BEARER_TOKEN=\"$BACKEND_SECRET\"" manifests/0?-secret_mtaanalysis.yaml # notsecret - cat manifests/0?-secret_mtaanalysis.yaml - - # deploy the manifests created by the ${{ steps.build-image.outputs.image }} image - kubectl apply -f manifests/ - sleep 5 - kubectl get deployment mtaanalysis -o jsonpath={.spec.template.spec.containers[]} - # give the pod time to start - sleep 15 - kubectl get pods -o wide - kubectl wait --for=condition=Ready=true pods -l "app=mtaanalysis" --timeout=5m - - - name: Run e2e script - run: | - export BACKEND_SECRET=$(kubectl get secret orchestrator-auth -o jsonpath={.data.backend-secret} | base64 -d) - e2e/mta.sh - - - name: Export kind Logs - if: always() - run: kind export logs ./kind_logs - - - name: Upload Kind Logs - uses: actions/upload-artifact@v4 - # Always run this, even if one of th previous steps failed. - if: always() - with: - name: kind-logs - path: ./kind_logs/ diff --git a/.github/workflows/mta-v6.x-e2e.yaml b/.github/workflows/mta-v6.x-e2e.yaml deleted file mode 100644 index 201813f7..00000000 --- a/.github/workflows/mta-v6.x-e2e.yaml +++ /dev/null @@ -1,165 +0,0 @@ -name: MTA v6.x Workflow end to end tests - -on: - workflow_dispatch: - pull_request: - branches: - - main - paths: - - 'mta-v6.x/**' - - 'pipeline/**' - - '!e2e/mta-v6.x.sh' - - '!mta-v6.x/*.svg' - - .github/workflows/mta-v6.x-e2e.yaml - - .github/workflows/main.yml - -jobs: - build: - uses: ./.github/workflows/main.yml - secrets: inherit - with: - workflow_id: mta-v6.x - it_mode: true - run-e2e: - runs-on: ubuntu-24.04 - needs: build - steps: - - uses: actions/checkout@v4 - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1.10.0 - with: - cluster_name: kind - - name: Install Konveyor 0.2 (MTA upstream equivalent to 6.2) - run: | - kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml - # give the apiserver time - sleep 5s - kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml - - # install konveyor operator - # version 0.2 is MTA 6.2 and 0.3 is 7.x - kubectl create -f https://operatorhub.io/install/konveyor-0.2/konveyor-operator.yaml - # give the apiserver time - echo "sleeping 300 seconds to give time for the operator to pull images and start" - sleep 300s - kubectl get csv -A - # TODO its a bit smelly that the csv name is coded here. - kubectl wait --for=jsonpath='{.status.phase}=Succeeded' -n my-konveyor-operator csv/konveyor-operator.v0.2.1 - kubectl get pods -A - kubectl wait --for=condition=Ready=true pods -l "name=tackle-operator" -n my-konveyor-operator --timeout=240s - kubectl get crds - kubectl create -f - << EOF - kind: Tackle - apiVersion: tackle.konveyor.io/v1alpha1 - metadata: - name: tackle - namespace: my-konveyor-operator - spec: - feature_auth_required: false - hub_database_volume_size: 1Gi - hub_bucket_volume_size: 1Gi - EOF - - kubectl get pods -n my-konveyor-operator - sleep 60s - kubectl get tackle -n my-konveyor-operator -o yaml - echo "wait for tackle ui to be ready" - kubectl get pods -n my-konveyor-operator - sleep 300s - kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=tackle-ui" -n my-konveyor-operator --timeout=240s - # now MTA workflow can execute agains tackle-ui.my-konveyor-operator.svc:8080 - - - name: Deploy Janus-idp-workflow-helm (janus + sonataflow-opertor) - run: | - helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart - helm install orchestrator orchestrator/orchestrator-k8s - - echo "sleep bit long till the PV for data index and kaniko cache is ready. its a bit slow. TODO fixit" - kubectl get pv - sleep 3m - kubectl get sfp -A - kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=600s - kubectl get pods -o wide - kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=600s - - - name: Download sonataflow artifacts generated manifests - uses: actions/download-artifact@v4 - with: - name: serverless-workflow-mta-v6.x-manifests - path: manifests - - - name: Download serverless workflows mta image - uses: actions/download-artifact@v4 - with: - name: serverless-workflow-mta-v6.x-${{ github.sha }}.tar - - - name: Load mta workflow image to Kind - run: | - kind load image-archive serverless-workflow-mta-v6.x-${{ github.sha }}.tar - - - - name: Deploy MTA serverless workflow - run: | - # Set the endpoint to the tackle-ui service - yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://orchestrator-backstage.default.svc.cluster.local:7007/"}] )' manifests/0?-sonataflow_mta-analysis-v6.yaml - - # reuse orchestrator psql persistence for e2e tests - kubectl patch secret orchestrator-postgresql --patch='{"stringData": { "postgres-username": "postgres" }}' - - yq --inplace ".spec.persistence = ( - { - \"postgresql\": { - \"secretRef\": { - \"name\": \"orchestrator-postgresql\", - \"userKey\": \"postgres-username\", - \"passwordKey\": \"postgres-password\" - }, - \"serviceRef\": { - \"name\": \"orchestrator-postgresql\", - \"port\": 5432, - \"databaseName\": \"postgres\", - \"databaseSchema\": \"mta\" - } - } - } - )" manifests/0?-sonataflow_mta-analysis-v6.yaml - echo "manifests/0?-configmap_mta-analysis-v6-props.yaml" - cat manifests/0?-configmap_mta-analysis-v6-props.yaml - echo "---" - - echo "manifests/0?-sonataflow_mta-analysis-v6.yaml" - cat manifests/0?-sonataflow_mta-analysis-v6.yaml - echo "---" - - # Set notification external access token - echo " Set notification external access token" - BACKEND_SECRET=$(kubectl get secret orchestrator-auth -o jsonpath={.data.backend-secret}) - yq --inplace ".data.NOTIFICATIONS_BEARER_TOKEN=\"$BACKEND_SECRET\"" manifests/0?-secret_mta-analysis-v6.yaml # notsecret - cat manifests/0?-secret_mta-analysis-v6.yaml - - # deploy the manifests created by the ${{ steps.build-image.outputs.image }} image - kubectl apply -f manifests/ - sleep 5 - kubectl get deployment mta-analysis-v6 -o jsonpath={.spec.template.spec.containers[]} - # give the pod time to start - sleep 15 - kubectl get pods -o wide - kubectl wait --for=condition=Ready=true pods -l "app=mta-analysis-v6" --timeout=10m - - - name: Run e2e script - run: | - export BACKEND_SECRET=$(kubectl get secret orchestrator-auth -o jsonpath={.data.backend-secret} | base64 -d) - e2e/mta-v6.x.sh - - - name: Export kind Logs - if: always() - run: kind export logs ./kind_logs - - - name: Upload Kind Logs - uses: actions/upload-artifact@v4 - # Always run this, even if one of the previous steps failed. - if: always() - with: - name: kind-logs - path: ./kind_logs/ - diff --git a/.github/workflows/mta-v6.x.yml b/.github/workflows/mta-v6.x.yml deleted file mode 100644 index 9ec36b26..00000000 --- a/.github/workflows/mta-v6.x.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: MTA v6.x workflow container image and manifest push - -on: - workflow_dispatch: - push: - branches: [ "main" ] - paths: - - 'mta-v6.x/**' - - 'pipeline/**' - - .github/workflows/mta-v6.x.yml - - .github/workflows/main.yml - -jobs: - call-main-workflow: - uses: ./.github/workflows/main.yml - with: - workflow_id: mta-v6.x - secrets: inherit - diff --git a/Makefile b/Makefile index 8455e4a7..2bdc262b 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,6 @@ WORKFLOWS = \ escalation \ move2kube \ mta \ - mta-v6.x \ mta-v7.x \ create-ocp-project \ $(NULL) diff --git a/e2e/mta-v6.x.sh b/e2e/mta-v6.x.sh deleted file mode 100755 index 15345ed7..00000000 --- a/e2e/mta-v6.x.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -set -x -set -e - -# holds the pid of the port forward process for cleanups -export port_forward_pid="" - -function cleanup() { - echo "cleanup $?" - kill "$port_forward_pid" || true -} - -function workflowDone() { - if [[ -n "${1}" ]]; then - id=$1 - curl -s -H "Content-Type: application/json" -H "Authorization: Bearer ${BACKEND_SECRET}" \ - localhost:9080/api/orchestrator/v2/workflows/instances/"${id}" | jq -e '.instance.state == "COMPLETED"' - fi -} - -trap 'cleanup' EXIT SIGTERM - -echo "Proxy Janus-idp port ⏳" -kubectl port-forward "$(kubectl get svc -l app.kubernetes.io/component=backstage -o name)" 9080:7007 & -port_forward_pid="$!" -sleep 3 -echo "Proxy Janus-idp port ✅" - -echo "End to end tests start ⏳" - -out=$(curl -XPOST -H "Content-Type: application/json" -H "Authorization: Bearer ${BACKEND_SECRET}" \ - http://localhost:9080/api/orchestrator/v2/workflows/mta-analysis-v6/execute -d '{"inputData": {"repositoryURL": "https://github.com/spring-projects/spring-petclinic", "recipients": ["user:default/guest"], "exportToIssueManager": "false", "migrationStartDatetime" : "2024-07-01T00:00:00Z", "migrationEndDatetime" : "2024-07-31T00:00:00Z"}}') -id=$(echo "$out" | jq -e .id) - -if [ -z "$id" ] || [ "$id" == "null" ]; then - echo "workflow instance id is null... exiting " - exit 1 -fi - -retries=20 -until eval "test ${retries} -eq 0 || workflowDone $id"; do - echo "checking workflow ${id} completed successfully" - sleep 5 - retries=$((retries-1)) -done - -echo "End to end tests passed ✅" - diff --git a/experimental-e2e-tests-on-ubuntu-vm/mta-v6.sh b/experimental-e2e-tests-on-ubuntu-vm/mta-v6.sh deleted file mode 100755 index dce506b9..00000000 --- a/experimental-e2e-tests-on-ubuntu-vm/mta-v6.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -set -x -set -e - -# Standup the cluster and install janus and konveyor operator -./cluster-up.sh -./janus-idp.sh -./konveyor-operator-0.2.1.sh - -cd .. - -# Create and push MTA image, generate manifests -sudo rm -rf ~/workdir -make WORKFLOW_ID="$WORKFLOW_ID" REGISTRY_REPO="$REGISTRY_REPO" LOCAL_TEST=true for-local-tests - -# Load workflow image -docker save quay.io/rhkp/serverless-workflow-"$WORKFLOW_ID":latest -o serverless-workflow-"$WORKFLOW_ID".tar - -if [ "$CLUSTER_TYPE" == "minikube" ]; then - minikube image load serverless-workflow-"$WORKFLOW_ID".tar -else - kind load image-archive serverless-workflow-"$WORKFLOW_ID".tar -fi - -# Copy generated manifests -rm -rf ./manifests -mkdir ./manifests -cp -r ~/workdir/"$WORKFLOW_ID"/manifests . - -# Set the endpoint to the tackle-ui service -yq --inplace '.spec.podTemplate.container.env |= ( . + [{"name": "QUARKUS_REST_CLIENT_MTA_JSON_URL", "value": "http://tackle-ui.my-konveyor-operator.svc:8080"}, {"name": "BACKSTAGE_NOTIFICATIONS_URL", "value": "http://janus-idp-workflows-backstage.default.svc.cluster.local:7007/api/notifications/"}] )' manifests/04-sonataflow_mta-analysis-v6.yaml - -# Disable persistence for e2e tests -yq e '.spec.persistence = {}' -i manifests/04-sonataflow_mta-analysis-v6.yaml -sed -i '/quarkus\.flyway\.migrate-at-start=true/d' manifests/03-configmap_mta-analysis-v6-props.yaml - -echo "manifests/03-configmap_mta-analysis-v6-props.yaml" -cat manifests/03-configmap_mta-analysis-v6-props.yaml -echo "---" - -echo "manifests/04-sonataflow_mta-analysis-v6.yaml" -cat manifests/04-sonataflow_mta-analysis-v6.yaml -echo "---" - -# deploy the manifests created by the ${{ steps.build-image.outputs.image }} image -kubectl apply -f manifests/ -sleep 5 -kubectl get deployment mta-analysis-v6 -o jsonpath='{.spec.template.spec.containers[]}' -# give the pod time to start -sleep 15 -kubectl get pods -o wide -kubectl wait --for=condition=Ready=true pods -l "app=mta-analysis-v6" --timeout=10m - -# Run the end to end test -./e2e/mta-v6.x.sh \ No newline at end of file diff --git a/experimental-e2e-tests-on-ubuntu-vm/readme.md b/experimental-e2e-tests-on-ubuntu-vm/readme.md index cb927722..8a845dbe 100644 --- a/experimental-e2e-tests-on-ubuntu-vm/readme.md +++ b/experimental-e2e-tests-on-ubuntu-vm/readme.md @@ -3,7 +3,7 @@ The purpose of this effort is to simulate the behavior of CI pipeline which perf ## Prerequisites - An available Ubuntu Server 24.04 LTS VM with specs equivalent to AWS' t3.2xlarge specifications -## Testing mta-v6.x workflow +## Testing mta-v7.x workflow - Clone the serverless-workflows repo which includes the code to ci tests ```shell ssh @@ -19,10 +19,10 @@ export REGISTRY_REPO= ./ubuntuvm.sh ``` -- Test the mta-v6.x workflow +- Test the mta-v7.x workflow ```shell -export WORKFLOW_ID=mta-v6.x -./mta-v6.sh +export WORKFLOW_ID=mta-v7.x +./mta-v7.sh ``` - Test the mta-v7.x workflow