From 536e456bd3e19f3f4026c702308ea2869c53e472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20So=C5=82tys?= <74361703+Sawthis@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:09:49 +0100 Subject: [PATCH] Remove pre-main-ory-reconciler-eval-integration-k3d (#9359) * Remove pre-main-ory-reconciler-eval-integration-k3d * Additional cleanup --- .../kyma-incubator/reconciler/reconciler.yaml | 50 ------ prow/scripts/provision-vm-and-run-manager.sh | 136 ---------------- ...-start-reconciler-istio-integration-k3d.sh | 150 ------------------ templates/data/incubator-buildpack-data.yaml | 28 ---- templates/data/istio-module-data.yaml | 10 -- templates/data/telemetry-manager-data.yaml | 9 -- 6 files changed, 383 deletions(-) delete mode 100755 prow/scripts/provision-vm-and-run-manager.sh delete mode 100755 prow/scripts/provision-vm-and-start-reconciler-istio-integration-k3d.sh diff --git a/prow/jobs/kyma-incubator/reconciler/reconciler.yaml b/prow/jobs/kyma-incubator/reconciler/reconciler.yaml index 364aa2c07750..0b59f67e6ee1 100644 --- a/prow/jobs/kyma-incubator/reconciler/reconciler.yaml +++ b/prow/jobs/kyma-incubator/reconciler/reconciler.yaml @@ -107,56 +107,6 @@ presubmits: # runs on PRs requests: memory: 3Gi cpu: 2 - - name: pre-main-ory-reconciler-eval-integration-k3d - annotations: - description: "runs ory reconciler integration tests with evaluation profile on k3d" - owner: "goat" - labels: - prow.k8s.io/pubsub.project: "sap-kyma-prow" - prow.k8s.io/pubsub.runID: "pre-main-ory-reconciler-eval-integration-k3d" - prow.k8s.io/pubsub.topic: "prowjobs" - preset-build-pr: "true" - preset-gc-project-env: "true" - preset-kyma-guard-bot-github-token: "true" - preset-sa-vm-kyma-integration: "true" - run_if_changed: '^((pkg/reconciler/instances/ory\S+)(\.[^.][^.][^.]+$|\.[^.][^dD]$|\.[^mM][^.]$|\.[^.]$|/[^.]+$))' - skip_report: false - decorate: true - cluster: untrusted-workload - max_concurrency: 10 - branches: - - ^main$ - extra_refs: - - org: kyma-project - repo: kyma - base_ref: main - - org: kyma-project - repo: test-infra - base_ref: main - spec: - containers: - - image: "europe-docker.pkg.dev/kyma-project/prod/testimages/e2e-gcloud:v20231121-05130964" - securityContext: - privileged: false - seccompProfile: - type: RuntimeDefault - allowPrivilegeEscalation: false - runAsUser: 0 - command: - - "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/provision-vm-and-start-reconciler-istio-integration-k3d.sh" - env: - - name: EXECUTION_PROFILE - value: "evaluation" - - name: GO11MODULE - value: "on" - - name: KYMA_VERSION - value: "main" - - name: TEST_NAME - value: "ory" - resources: - requests: - memory: 3Gi - cpu: 2 - name: pre-main-ory-reconciler-prod-integration-gcp annotations: description: "runs ory reconciler integration tests with production profile on Gardener GCP cluster" diff --git a/prow/scripts/provision-vm-and-run-manager.sh b/prow/scripts/provision-vm-and-run-manager.sh deleted file mode 100755 index 1179812ad47a..000000000000 --- a/prow/scripts/provision-vm-and-run-manager.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash - -# This script is designed to provision a new vm and run specific target from the Makefile on the repository root path. -# -# INPUT: -# - JOB_REPO_NAME: name of the repository in the kyma-project org -# - JOB_VM_COMMAND: desired command that should be run on vm - -set -o errexit - -date - -readonly SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -readonly TEST_INFRA_SOURCES_DIR="$(cd "${SCRIPT_DIR}/../../" && pwd)" -readonly KYMA_PROJECT_DIR="$(cd "${SCRIPT_DIR}/../../../" && pwd)" - -# shellcheck source=prow/scripts/lib/log.sh -source "${SCRIPT_DIR}/lib/log.sh" -# shellcheck source=prow/scripts/lib/utils.sh -source "$SCRIPT_DIR/lib/utils.sh" -# shellcheck source=prow/scripts/lib/gcp.sh -source "$SCRIPT_DIR/lib/gcp.sh" - -if [[ "${BUILD_TYPE}" == "pr" ]]; then - log::info "Execute Job Guard" - "${TEST_INFRA_SOURCES_DIR}/cmd/jobguard/run.sh" -fi - -cleanup() { - ARG=$? - log::info "Removing instance ${JOB_REPO_NAME}-test-${RANDOM_ID}" - gcloud compute instances delete --zone="${ZONE}" "${JOB_REPO_NAME}-test-${RANDOM_ID}" || true ### Workaround: not failing the job regardless of the vm deletion result - date - exit $ARG -} - -function testCustomImage() { - CUSTOM_IMAGE="$1" - IMAGE_EXISTS=$(gcloud compute images list --filter "name:${CUSTOM_IMAGE}" | tail -n +2 | awk '{print $1}') - if [[ -z "$IMAGE_EXISTS" ]]; then - log::error "${CUSTOM_IMAGE} is invalid, it is not available in GCP images list, the script will terminate ..." && exit 1 - fi -} - -gcp::authenticate \ - -c "${GOOGLE_APPLICATION_CREDENTIALS}" - -RANDOM_ID=$(openssl rand -hex 4) - -LABELS="" -if [[ -z "${PULL_NUMBER}" ]]; then - LABELS=(--labels "branch=$PULL_BASE_REF,job-name=${JOB_REPO_NAME}") -else - LABELS=(--labels "pull-number=$PULL_NUMBER,job-name=${JOB_REPO_NAME}") -fi - -POSITIONAL=() -while [[ $# -gt 0 ]] -do - key="$1" - - case ${key} in - --image) - IMAGE="$2" - testCustomImage "${IMAGE}" - shift - shift - ;; - --*) - echo "Unknown flag ${1}" - exit 1 - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; - esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - - -if [[ -z "$IMAGE" ]]; then - log::info "Provisioning vm using the latest default custom image ..." - - IMAGE=$(gcloud compute images list --sort-by "~creationTimestamp" \ - --filter "family:custom images AND labels.default:yes" --limit=1 | tail -n +2 | awk '{print $1}') - - if [[ -z "$IMAGE" ]]; then - log::error "There are no default custom images, the script will exit ..." && exit 1 - fi - fi - -date - -ZONE_LIMIT=${ZONE_LIMIT:-5} -EU_ZONES=$(gcloud compute zones list --filter="name~europe" --limit="${ZONE_LIMIT}" | tail -n +2 | awk '{print $1}') -STARTTIME=$(date +%s) -for ZONE in ${EU_ZONES}; do - log::info "Attempting to create a new instance named ${JOB_REPO_NAME}-test-${RANDOM_ID} in zone ${ZONE} using image ${IMAGE}" - gcloud compute instances create "${JOB_REPO_NAME}-test-${RANDOM_ID}" \ - --metadata enable-oslogin=TRUE \ - --image "${IMAGE}" \ - --machine-type n1-standard-4 \ - --zone "${ZONE}" \ - --boot-disk-size 200 "${LABELS[@]}" &&\ - log::info "Created ${JOB_REPO_NAME}-test-${RANDOM_ID} in zone ${ZONE}" && break - log::error "Could not create machine in zone ${ZONE}" -done || exit 1 -ENDTIME=$(date +%s) -echo "VM creation time: $((ENDTIME - STARTTIME)) seconds." - -trap cleanup exit INT -# apply overrides if we are not using the default test suite -if [[ ${INTEGRATION_SUITE} == "git-auth-integration" ]]; then - log::info "Creating Serverless git-auth-integration overrides" - mkdir -p "${KYMA_PROJECT_DIR}/overrides" - cat <> "${KYMA_PROJECT_DIR}/overrides/integration-overrides.yaml" -gitAuth: - github: - key: "${GH_AUTH_PRIVATE_KEY}" - azure: - username: "${AZURE_DEVOPS_AUTH_USERNAME}" - password: "${AZURE_DEVOPS_AUTH_PASSWORD}" -EOF - -fi - -log::info "Copying Reconciler to the instance" -#shellcheck disable=SC2088 -utils::compress_send_to_vm "${ZONE}" "${JOB_REPO_NAME}-test-${RANDOM_ID}" "/home/prow/go/src/github.com/kyma-project/${JOB_REPO_NAME}" "~/${JOB_REPO_NAME}" - -log::info "Triggering the installation" - -# shellcheck disable=SC2016 -utils::ssh_to_vm_with_script -z "${ZONE}" -n "${JOB_REPO_NAME}-test-${RANDOM_ID}" -c "sudo bash -c \"cd \$HOME/${JOB_REPO_NAME} && ${JOB_VM_COMMAND}\"" -log::success "all done" diff --git a/prow/scripts/provision-vm-and-start-reconciler-istio-integration-k3d.sh b/prow/scripts/provision-vm-and-start-reconciler-istio-integration-k3d.sh deleted file mode 100755 index 7638d60182e7..000000000000 --- a/prow/scripts/provision-vm-and-start-reconciler-istio-integration-k3d.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash - -# This script is designed to provision a new vm and start kyma.It takes an optional positional parameter using --image flag -# Use this flag to specify the custom image for provisining vms. If no flag is provided, the latest custom image is used. - -set -xo errexit - -readonly SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -readonly TEST_INFRA_SOURCES_DIR="$(cd "${SCRIPT_DIR}/../../" && pwd)" -readonly KYMA_PROJECT_DIR="$(cd "${SCRIPT_DIR}/../../../" && pwd)" -export KYMA_SOURCES_DIR="${KYMA_PROJECT_DIR}/kyma" -# shellcheck source=prow/scripts/lib/log.sh -source "${TEST_INFRA_SOURCES_DIR}/prow/scripts/lib/log.sh" -# shellcheck source=prow/scripts/lib/utils.sh -source "${TEST_INFRA_SOURCES_DIR}/prow/scripts/lib/utils.sh" -# shellcheck source=prow/scripts/lib/gcp.sh -source "$TEST_INFRA_SOURCES_DIR/prow/scripts/lib/gcp.sh" -# shellcheck source=prow/scripts/lib/kyma.sh -source "${TEST_INFRA_SOURCES_DIR}/prow/scripts/lib/kyma.sh" -# shellcheck source=prow/scripts/cluster-integration/helpers/integration-tests.sh -source "${TEST_INFRA_SOURCES_DIR}/prow/scripts/cluster-integration/helpers/integration-tests.sh" - -if [[ "${BUILD_TYPE}" == "pr" ]]; then - log::info "Execute Job Guard" - "${TEST_INFRA_SOURCES_DIR}/cmd/jobguard/run.sh" -fi - -cleanup() { - # TODO - collect junit results - log::info "Stopping instance reconciler-istio-integration-test-${RANDOM_ID}" - log::info "It will be removed automatically by cleaner job" - - # do not fail the job regardless of the vm deletion result - set +e - - gcloud compute instances stop --async --zone="${ZONE}" "reconciler-istio-integration-test-${RANDOM_ID}" - - log::info "End of cleanup" -} - -function testCustomImage() { - CUSTOM_IMAGE="$1" - IMAGE_EXISTS=$(gcloud compute images list --filter "name:${CUSTOM_IMAGE}" | tail -n +2 | awk '{print $1}') - if [[ -z "$IMAGE_EXISTS" ]]; then - log::error "${CUSTOM_IMAGE} is invalid, it is not available in GCP images list, the script will terminate ..." && exit 1 - fi -} - -gcp::authenticate \ - -c "${GOOGLE_APPLICATION_CREDENTIALS}" - -RANDOM_ID=$(LC_ALL=C tr -dc '[:lower:]' < /dev/urandom | head -c4) - -LABELS="" -if [[ -z "${PULL_NUMBER}" ]]; then - LABELS=(--labels "branch=$PULL_BASE_REF,job-name=reconciler-integration") -else - LABELS=(--labels "pull-number=$PULL_NUMBER,job-name=reconciler-integration") -fi - -POSITIONAL=() -while [[ $# -gt 0 ]]; do - key="$1" - - case ${key} in - --image) - IMAGE="$2" - testCustomImage "${IMAGE}" - shift - shift - ;; - --*) - echo "Unknown flag ${1}" - exit 1 - ;; - *) # unknown option - POSITIONAL+=("$1") # save it in an array for later - shift # past argument - ;; - esac -done -set -- "${POSITIONAL[@]}" # restore positional parameters - - -if [[ -z "$IMAGE" ]]; then - log::info "Provisioning vm using the latest default custom image ..." - - IMAGE=$(gcloud compute images list --sort-by "~creationTimestamp" \ - --filter "family:custom images AND labels.default:yes" --limit=1 | tail -n +2 | awk '{print $1}') - - if [[ -z "$IMAGE" ]]; then - log::error "There are no default custom images, the script will exit ..." && exit 1 - fi -fi - -ZONE_LIMIT=${ZONE_LIMIT:-5} -EU_ZONES=$(gcloud compute zones list --filter="name~europe" --limit="${ZONE_LIMIT}" | tail -n +2 | awk '{print $1}') -STARTTIME=$(date +%s) -for ZONE in ${EU_ZONES}; do - log::info "Attempting to create a new instance named reconciler-istio-integration-test-${RANDOM_ID} in zone ${ZONE} using image ${IMAGE}" - gcloud compute instances create "reconciler-istio-integration-test-${RANDOM_ID}" \ - --metadata enable-oslogin=TRUE \ - --image "${IMAGE}" \ - --machine-type n2-standard-4 \ - --zone "${ZONE}" \ - --boot-disk-size 200 "${LABELS[@]}" && \ - log::info "Created reconciler-istio-integration-test-${RANDOM_ID} in zone ${ZONE}" && break - log::error "Could not create machine in zone ${ZONE}" -done || exit 1 -ENDTIME=$(date +%s) -echo "VM creation time: $((ENDTIME - STARTTIME)) seconds." - -trap cleanup exit INT - -# Determine Kyma version from the latest release -if [[ ! $KYMA_VERSION ]]; then - # Fetch latest Kyma2 release - kyma::get_last_release_version -t "${BOT_GITHUB_TOKEN}" - export KYMA_VERSION="${kyma_get_last_release_version_return_version:?}" - log::info "Reading latest Kyma release version, got: ${KYMA_VERSION}" -fi - -git config --global --add safe.directory "${KYMA_SOURCES_DIR}" - -# Determine Istio version based on Kyma version -istio::get_version -export ISTIO_VERSION="${istio_version:?}" -log::info "Reading Istio version from ${KYMA_VERSION}, got: ${ISTIO_VERSION}" - -log::info "Preparing environment variables for the instance" -envVars=( - TEST_NAME - EXECUTION_PROFILE - KYMA_VERSION - ISTIO_VERSION -) -utils::save_env_file "${envVars[@]}" -#shellcheck disable=SC2088 -utils::send_to_vm "${ZONE}" "reconciler-istio-integration-test-${RANDOM_ID}" ".env" "~/.env" - -log::info "Copying Reconciler to the instance" -#shellcheck disable=SC2088 -utils::compress_send_to_vm "${ZONE}" "reconciler-istio-integration-test-${RANDOM_ID}" "/home/prow/go/src/github.com/kyma-incubator/reconciler" "~/reconciler" -#shellcheck disable=SC2088 -utils::compress_send_to_vm "${ZONE}" "reconciler-istio-integration-test-${RANDOM_ID}" "/home/prow/go/src/github.com/kyma-project/test-infra" "~/test-infra" - -log::info "Triggering the installation" -utils::ssh_to_vm_with_script -z "${ZONE}" -n "reconciler-istio-integration-test-${RANDOM_ID}" -c "sudo bash" -p "${SCRIPT_DIR}/cluster-integration/reconciler-istio-integration.sh" - -log::success "all done" diff --git a/templates/data/incubator-buildpack-data.yaml b/templates/data/incubator-buildpack-data.yaml index c72bd41a28bd..47fa529e903c 100644 --- a/templates/data/incubator-buildpack-data.yaml +++ b/templates/data/incubator-buildpack-data.yaml @@ -69,8 +69,6 @@ templates: GO11MODULE: "on" branches: - ^develop$ - reconciler_component_k3d_integration_jobConfig: - command: "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/provision-vm-and-start-reconciler-istio-integration-k3d.sh" reconciler_component_gardener_integration_jobConfig: command: "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/reconciler/reconciler-component-provision-gardener.sh" reconciler_e2e_jobConfig: @@ -155,32 +153,6 @@ templates: local: - extra_refs_kyma_cli - reconciler_publish_pr_cli_jobConfig - - jobConfig: - name: "pre-main-ory-reconciler-eval-integration-k3d" - annotations: - owner: goat - description: runs ory reconciler integration tests with evaluation profile on k3d - # following regexp won't start build if only Markdown files were changed - run_if_changed: "^((pkg/reconciler/instances/ory\\S+)(\\.[^.][^.][^.]+$|\\.[^.][^dD]$|\\.[^mM][^.]$|\\.[^.]$|/[^.]+$))" - labels: - preset-build-pr: "true" - preset-kyma-guard-bot-github-token: "true" - preset-sa-vm-kyma-integration: "true" - preset-gc-project-env: "true" - env: - TEST_NAME: ory - EXECUTION_PROFILE: evaluation - KYMA_VERSION: main - inheritedConfigs: - global: - - jobConfig_default - - jobConfig_presubmit - - extra_refs_test-infra - - extra_refs_kyma - local: - - reconciler_main_jobConfig - - reconciler_component_k3d_integration_jobConfig - - reconciler_e2e_image - jobConfig: name: "pre-main-ory-reconciler-prod-integration-gcp" annotations: diff --git a/templates/data/istio-module-data.yaml b/templates/data/istio-module-data.yaml index 4f0b9e7b41fe..83171fa5c666 100644 --- a/templates/data/istio-module-data.yaml +++ b/templates/data/istio-module-data.yaml @@ -35,16 +35,6 @@ templates: readOnly: true job_skip_config: skip_if_only_changed: 'sec-scanners-config\.yaml$|^docs/|^tests/performance/|\.md$|^(OWNERS|CODEOWNERS)$|^\.' - vm_job_make: - command: "bash" - env: - CLOUDSDK_COMPUTE_ZONE: "europe-west4-b" - JOB_REPO_NAME: "istio" - args: - - "-c" - - "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/provision-vm-and-run-manager.sh" - request_memory: 200Mi - request_cpu: 80m vm_job_labels: labels: preset-kyma-guard-bot-github-token: "true" diff --git a/templates/data/telemetry-manager-data.yaml b/templates/data/telemetry-manager-data.yaml index 95d21ac18860..84e72594dd73 100644 --- a/templates/data/telemetry-manager-data.yaml +++ b/templates/data/telemetry-manager-data.yaml @@ -6,15 +6,6 @@ templates: job_default: securityContext: privileged: false - vm_job_make: - command: "bash" - env: - JOB_REPO_NAME: "telemetry-manager" - args: - - "-c" - - "/home/prow/go/src/github.com/kyma-project/test-infra/prow/scripts/provision-vm-and-run-manager.sh" - request_memory: 200Mi - request_cpu: 80m vm_job_labels: labels: preset-kyma-guard-bot-github-token: "true"