From 520a868396ba914a63d01c2757d9d4c16c4c7e46 Mon Sep 17 00:00:00 2001 From: hbelmiro Date: Thu, 20 Jun 2024 16:31:00 -0300 Subject: [PATCH] Migrated kubeflow-pipeline-upgrade-test to GitHub Actions Signed-off-by: hbelmiro --- .github/workflows/upgrade-test.yml | 37 ++++++++ test/e2e_test_gke_v2.yaml | 84 ----------------- test/upgrade-tests.sh | 144 ----------------------------- 3 files changed, 37 insertions(+), 228 deletions(-) create mode 100644 .github/workflows/upgrade-test.yml delete mode 100755 test/upgrade-tests.sh diff --git a/.github/workflows/upgrade-test.yml b/.github/workflows/upgrade-test.yml new file mode 100644 index 00000000000..83b13c9af5c --- /dev/null +++ b/.github/workflows/upgrade-test.yml @@ -0,0 +1,37 @@ +name: KFP upgrade tests + +on: + push: + branches: [master] + + pull_request: + paths: + - '.github/workflows/upgrade-test.yml' + - 'backend/**' + - 'manifests/kustomize/**' + +jobs: + upgrade-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create KFP cluster + uses: ./.github/actions/kfp-cluster + + - name: Prepare upgrade tests + working-directory: backend/test/integration + run: go test -v ./... -namespace ${NAMESPACE} -args -runUpgradeTests=true -testify.m=Prepare + + - name: Prepare verification tests + working-directory: backend/test/integration + run: go test -v ./... -namespace ${NAMESPACE} -args -runUpgradeTests=true -testify.m=Verify + + - name: Prepare upgrade tests v2 + working-directory: backend/test/v2/integration/ + run: go test -v ./... -namespace ${NAMESPACE} -args -runUpgradeTests=true -testify.m=Prepare + + - name: Prepare verification tests v2 + working-directory: backend/test/v2/integration + run: go test -v ./... -namespace ${NAMESPACE} -args -runUpgradeTests=true -testify.m=Verify diff --git a/test/e2e_test_gke_v2.yaml b/test/e2e_test_gke_v2.yaml index f107ed10f4e..76e4dce047f 100644 --- a/test/e2e_test_gke_v2.yaml +++ b/test/e2e_test_gke_v2.yaml @@ -37,90 +37,6 @@ spec: - name: namespace value: kubeflow templates: - - name: upgrade-test-preparation - inputs: - parameters: - - name: target-image-prefix - - name: test-results-gcs-dir - - name: api-integration-test-image-suffix - steps: - - - name: build-api-integration-test-image - template: build-image - arguments: - parameters: - - name: docker-path - value: . - - name: docker-file - value: test/api-integration-test/Dockerfile - - name: image-name - value: "{{inputs.parameters.target-image-prefix}}{{inputs.parameters.api-integration-test-image-suffix}}" - - - name: run-upgrade-tests-preparation - template: run-upgrade-tests-preparation - arguments: - parameters: - - name: test-results-gcs-dir - value: "{{inputs.parameters.test-results-gcs-dir}}" - - name: api-integration-test-image - value: "{{inputs.parameters.target-image-prefix}}{{inputs.parameters.api-integration-test-image-suffix}}" - - - name: upgrade-test-verification - inputs: - parameters: - - name: target-image-prefix - - name: test-results-gcs-dir - - name: api-integration-test-image-suffix - steps: - - - name: run-upgrade-tests-verification - template: run-upgrade-tests-verification - arguments: - parameters: - - name: test-results-gcs-dir - value: "{{inputs.parameters.test-results-gcs-dir}}" - - name: api-integration-test-image - value: "{{inputs.parameters.target-image-prefix}}{{inputs.parameters.api-integration-test-image-suffix}}" - - - name: upgrade-test-preparation-v2 - inputs: - parameters: - - name: target-image-prefix - - name: test-results-gcs-dir - - name: api-integration-test-image-suffix - steps: - - - name: build-api-integration-test-image - template: build-image - arguments: - parameters: - - name: docker-path - value: . - - name: docker-file - value: test/api-integration-test/Dockerfile - - name: image-name - value: "{{inputs.parameters.target-image-prefix}}{{inputs.parameters.api-integration-test-image-suffix}}" - - - name: run-upgrade-tests-preparation-v2 - template: run-upgrade-tests-preparation-v2 - arguments: - parameters: - - name: test-results-gcs-dir - value: "{{inputs.parameters.test-results-gcs-dir}}/v2" - - name: api-integration-test-image - value: "{{inputs.parameters.target-image-prefix}}{{inputs.parameters.api-integration-test-image-suffix}}" - - - name: upgrade-test-verification-v2 - inputs: - parameters: - - name: target-image-prefix - - name: test-results-gcs-dir - - name: api-integration-test-image-suffix - steps: - - - name: run-upgrade-tests-verification-v2 - template: run-upgrade-tests-verification-v2 - arguments: - parameters: - - name: test-results-gcs-dir - value: "{{inputs.parameters.test-results-gcs-dir}}/v2" - - name: api-integration-test-image - value: "{{inputs.parameters.target-image-prefix}}{{inputs.parameters.api-integration-test-image-suffix}}" - # Build and push image - name: build-image retryStrategy: diff --git a/test/upgrade-tests.sh b/test/upgrade-tests.sh deleted file mode 100755 index fe646f61e1b..00000000000 --- a/test/upgrade-tests.sh +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/bash -# -# Copyright 2018 The Kubeflow Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -usage() -{ - echo "usage: upgrade-tests.sh - [--platform the deployment platform. Valid values are: [gcp, minikube]. Default is gcp.] - [--project the gcp project. Default is ml-pipeline-test. Only used when platform is gcp.] - [--test_result_bucket the gcs bucket that argo workflow store the result to. Default is ml-pipeline-test - [--test_result_folder the gcs folder that argo workflow store the result to. Always a relative directory to gs:///[PULL_SHA]] - [--timeout timeout of the tests in seconds. Default is 1800 seconds. ] - [--test_v2_api run test using v2 API] - [-h help]" -} - -PLATFORM=gcp -PROJECT=ml-pipeline-test -TEST_RESULT_BUCKET=ml-pipeline-test -TIMEOUT_SECONDS=2700 # 45 minutes -NAMESPACE=kubeflow -WORKFLOW_FILE=e2e_test_gke_v2.yaml - -while [ "$1" != "" ]; do - case $1 in - --platform ) shift - PLATFORM=$1 - ;; - --project ) shift - PROJECT=$1 - ;; - --test_result_bucket ) shift - TEST_RESULT_BUCKET=$1 - ;; - --test_result_folder ) shift - TEST_RESULT_FOLDER=$1 - ;; - --timeout ) shift - TIMEOUT_SECONDS=$1 - ;; - --test_v2_api ) - TEST_V2_API=true - ;; - -h | --help ) usage - exit - ;; - * ) usage - exit 1 - esac - shift -done - -# This is merged commit's SHA. -COMMIT_SHA="$(git rev-parse HEAD)" - -# Paths are using commit sha, instead of pull sha, because tests may be rerun with the same PR -# commit, but merged on a different master version. When this happens, we cannot reuse cached -# results on the previous test run. -GCR_IMAGE_BASE_DIR=gcr.io/${PROJECT}/${COMMIT_SHA} -TEST_RESULTS_GCS_DIR=gs://${TEST_RESULT_BUCKET}/${COMMIT_SHA}/${TEST_RESULT_FOLDER} -DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null && pwd)" -# exclude SDK release tags -LATEST_RELEASED_TAG=$(git tag --sort=v:refname | grep -v "sdk-" | tail -1) - -# Configure `time` command output format. -TIMEFORMAT="[test-timing] It took %lR." - -echo "upgrade test starts" -if [ -n "$PULL_PULL_SHA" ]; then - echo "PR commit is ${PULL_PULL_SHA}" -fi -time source "${DIR}/test-prep.sh" -echo "test env prepared" - -time source "${DIR}/build-images.sh" -echo "KFP images cloudbuild jobs submitted" - -time TEST_CLUSTER_PREFIX="upgrade" \ - source "${DIR}/deploy-cluster.sh" -echo "cluster deployed" - -# Install Argo CLI and test-runner service account -time source "${DIR}/install-argo.sh" -echo "argo installed" - -time KFP_DEPLOY_RELEASE=true source "${DIR}/deploy-pipeline-lite.sh" -echo "KFP standalone of latest release deployed" - -if [ -n "$TEST_V2_API" ]; then - TEST_PREPARATION_ENTRYPOINT=upgrade-test-preparation-v2 - TEST_VERIFICATION_ENTRYPOINT=upgrade-test-verification-v2 -else - TEST_PREPARATION_ENTRYPOINT=upgrade-test-preparation - TEST_VERIFICATION_ENTRYPOINT=upgrade-test-verification -fi - - -echo "submitting argo workflow to setup test env before upgrade..." -ARGO_WORKFLOW=`argo submit ${DIR}/${WORKFLOW_FILE} \ ---entrypoint ${TEST_PREPARATION_ENTRYPOINT} \ --p image-build-context-gcs-uri="$remote_code_archive_uri" \ -${IMAGE_BUILDER_ARG} \ --p target-image-prefix="${GCR_IMAGE_BASE_DIR}/" \ --p test-results-gcs-dir="${TEST_RESULTS_GCS_DIR}" \ --n ${NAMESPACE} \ ---serviceaccount test-runner \ --o name -` -time source "${DIR}/check-argo-status.sh" -echo "upgrade test preparation workflow completed" - -time source "${DIR}/check-build-image-status.sh" -echo "KFP images built" - -time source "${DIR}/deploy-pipeline-lite.sh" -echo "KFP standalone of commit ${COMMIT_SHA} deployed" - -echo "submitting argo workflow to verify test env after upgrade..." -ARGO_WORKFLOW=`argo submit ${DIR}/${WORKFLOW_FILE} \ ---entrypoint ${TEST_VERIFICATION_ENTRYPOINT} \ --p image-build-context-gcs-uri="$remote_code_archive_uri" \ -${IMAGE_BUILDER_ARG} \ --p target-image-prefix="${GCR_IMAGE_BASE_DIR}/" \ --p test-results-gcs-dir="${TEST_RESULTS_GCS_DIR}" \ --n ${NAMESPACE} \ ---serviceaccount test-runner \ --o name -` -time source "${DIR}/check-argo-status.sh" -echo "upgrade test verification workflow completed"