|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -o nounset |
| 4 | +set -o errexit |
| 5 | +set -o pipefail |
| 6 | + |
| 7 | +cluster_profile=/var/run/secrets/ci.openshift.io/cluster-profile |
| 8 | +export AWS_SHARED_CREDENTIALS_FILE=${cluster_profile}/.awscred |
| 9 | +export AZURE_AUTH_LOCATION=${cluster_profile}/osServicePrincipal.json |
| 10 | +export GCP_SHARED_CREDENTIALS_FILE=${cluster_profile}/gce.json |
| 11 | +export HOME=/tmp/home |
| 12 | +export PATH=/usr/libexec/origin:$PATH |
| 13 | + |
| 14 | +trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM |
| 15 | + |
| 16 | +mkdir -p "${HOME}" |
| 17 | + |
| 18 | +# if the cluster profile included an insights secret, install it to the cluster to |
| 19 | +# report support data from the support-operator |
| 20 | +if [[ -f "${cluster_profile}/insights-live.yaml" ]]; then |
| 21 | + oc create -f "${cluster_profile}/insights-live.yaml" || true |
| 22 | +fi |
| 23 | + |
| 24 | +# set up cloud-provider-specific env vars |
| 25 | +KUBE_SSH_BASTION="$( oc --insecure-skip-tls-verify get node -l node-role.kubernetes.io/master -o 'jsonpath={.items[0].status.addresses[?(@.type=="ExternalIP")].address}' ):22" |
| 26 | +KUBE_SSH_KEY_PATH=${cluster_profile}/ssh-privatekey |
| 27 | +export KUBE_SSH_BASTION KUBE_SSH_KEY_PATH |
| 28 | +case "${CLUSTER_TYPE}" in |
| 29 | +gcp) |
| 30 | + export GOOGLE_APPLICATION_CREDENTIALS="${GCP_SHARED_CREDENTIALS_FILE}" |
| 31 | + export KUBE_SSH_USER=core |
| 32 | + mkdir -p ~/.ssh |
| 33 | + cp "${cluster_profile}/ssh-privatekey" ~/.ssh/google_compute_engine || true |
| 34 | + export TEST_PROVIDER='{"type":"gce","region":"us-east1","multizone": true,"multimaster":true,"projectid":"openshift-gce-devel-ci"}' |
| 35 | + ;; |
| 36 | +aws) |
| 37 | + mkdir -p ~/.ssh |
| 38 | + cp "${cluster_profile}/ssh-privatekey" ~/.ssh/kube_aws_rsa || true |
| 39 | + export PROVIDER_ARGS="-provider=aws -gce-zone=us-east-1" |
| 40 | + # TODO: make openshift-tests auto-discover this from cluster config |
| 41 | + REGION="$(oc get -o jsonpath='{.status.platformStatus.aws.region}' infrastructure cluster)" |
| 42 | + ZONE="$(oc get -o jsonpath='{.items[0].metadata.labels.failure-domain\.beta\.kubernetes\.io/zone}' nodes)" |
| 43 | + export TEST_PROVIDER="{\"type\":\"aws\",\"region\":\"${REGION}\",\"zone\":\"${ZONE}\",\"multizone\":true,\"multimaster\":true}" |
| 44 | + export KUBE_SSH_USER=core |
| 45 | + ;; |
| 46 | +azure4) export TEST_PROVIDER=azure;; |
| 47 | +*) echo >&2 "Unsupported cluster type '${CLUSTER_TYPE}'"; exit 1;; |
| 48 | +esac |
| 49 | + |
| 50 | +mkdir -p /tmp/output |
| 51 | +cd /tmp/output |
| 52 | + |
| 53 | +if [[ "${CLUSTER_TYPE}" == gcp ]]; then |
| 54 | + pushd /tmp |
| 55 | + curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-256.0.0-linux-x86_64.tar.gz |
| 56 | + tar -xzf google-cloud-sdk-256.0.0-linux-x86_64.tar.gz |
| 57 | + export PATH=$PATH:/tmp/google-cloud-sdk/bin |
| 58 | + mkdir gcloudconfig |
| 59 | + export CLOUDSDK_CONFIG=/tmp/gcloudconfig |
| 60 | + gcloud auth activate-service-account --key-file="${GCP_SHARED_CREDENTIALS_FILE}" |
| 61 | + gcloud config set project openshift-gce-devel-ci |
| 62 | + popd |
| 63 | +fi |
| 64 | + |
| 65 | +test_suite=openshift/conformance/parallel |
| 66 | +if [[ -e "${SHARED_DIR}/test-suite.txt" ]]; then |
| 67 | + test_suite=$(<"${SHARED_DIR}/test-suite.txt") |
| 68 | +fi |
| 69 | + |
| 70 | +openshift-tests run "${test_suite}" \ |
| 71 | + --provider "${TEST_PROVIDER}" \ |
| 72 | + -o /tmp/artifacts/e2e.log \ |
| 73 | + --junit-dir /tmp/artifacts/junit |
0 commit comments