sigs.k8s.io/cluster-api-provider-azure@v1.17.0/scripts/ci-conformance.sh (about) 1 #!/bin/bash 2 3 # Copyright 2020 The Kubernetes Authors. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 ############################################################################### 18 19 # This script is executed by presubmit `pull-cluster-api-provider-azure-e2e` 20 # To run locally, set AZURE_CLIENT_ID, AZURE_SUBSCRIPTION_ID, AZURE_TENANT_ID 21 22 set -o errexit 23 set -o nounset 24 set -o pipefail 25 26 # Install kubectl 27 REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 28 KUBECTL="${REPO_ROOT}/hack/tools/bin/kubectl" 29 KIND="${REPO_ROOT}/hack/tools/bin/kind" 30 KUSTOMIZE="${REPO_ROOT}/hack/tools/bin/kustomize" 31 make --directory="${REPO_ROOT}" "${KUBECTL##*/}" "${KIND##*/}" "${KUSTOMIZE##*/}" 32 33 # shellcheck source=hack/ensure-go.sh 34 source "${REPO_ROOT}/hack/ensure-go.sh" 35 # shellcheck source=hack/ensure-tags.sh 36 source "${REPO_ROOT}/hack/ensure-tags.sh" 37 # shellcheck source=hack/util.sh 38 source "${REPO_ROOT}/hack/util.sh" 39 40 # Verify the required Environment Variables are present. 41 capz::util::ensure_azure_envs 42 43 export USE_LOCAL_KIND_REGISTRY=${USE_LOCAL_KIND_REGISTRY:-"true"} 44 45 if [[ "${USE_LOCAL_KIND_REGISTRY}" == "true" ]]; then 46 export REGISTRY="localhost:5000/ci-e2e" 47 else 48 : "${REGISTRY:?Environment variable empty or not defined.}" 49 "${REPO_ROOT}"/hack/ensure-acr-login.sh 50 if [[ "$(capz::util::should_build_kubernetes)" == "true" ]]; then 51 export E2E_ARGS="-kubetest.use-pr-artifacts" 52 export KUBE_BUILD_CONFORMANCE="y" 53 source "${REPO_ROOT}/scripts/ci-build-kubernetes.sh" 54 fi 55 56 if [[ "$(capz::util::should_build_ccm)" == "true" ]]; then 57 # shellcheck source=scripts/ci-build-azure-ccm.sh 58 source "${REPO_ROOT}/scripts/ci-build-azure-ccm.sh" 59 echo "Will use the ${IMAGE_REGISTRY}/${CCM_IMAGE_NAME}:${IMAGE_TAG_CCM} cloud-controller-manager image for external cloud-provider-cluster" 60 echo "Will use the ${IMAGE_REGISTRY}/${CNM_IMAGE_NAME}:${IMAGE_TAG_CNM} cloud-node-manager image for external cloud-provider-azure cluster" 61 fi 62 fi 63 64 defaultTag=$(date -u '+%Y%m%d%H%M%S') 65 export TAG="${defaultTag:-dev}" 66 export GINKGO_NODES=1 67 68 export AZURE_LOCATION="${AZURE_LOCATION:-$(capz::util::get_random_region)}" 69 export AZURE_LOCATION_GPU="${AZURE_LOCATION_GPU:-$(capz::util::get_random_region_gpu)}" 70 export AZURE_LOCATION_EDGEZONE="${AZURE_LOCATION_EDGEZONE:-$(capz::util::get_random_region_edgezone)}" 71 export AZURE_CONTROL_PLANE_MACHINE_TYPE="${AZURE_CONTROL_PLANE_MACHINE_TYPE:-"Standard_B2s"}" 72 export AZURE_NODE_MACHINE_TYPE="${AZURE_NODE_MACHINE_TYPE:-"Standard_B2s"}" 73 export WINDOWS="${WINDOWS:-false}" 74 75 # Generate SSH key. 76 capz::util::generate_ssh_key 77 78 capz::ci-conformance::cleanup() { 79 "${REPO_ROOT}/hack/log/redact.sh" || true 80 } 81 82 trap capz::ci-conformance::cleanup EXIT 83 84 if [[ "${WINDOWS}" == "true" ]]; then 85 make test-windows-upstream 86 else 87 make test-conformance 88 fi