update test-infra in vendor (#1386)

This commit is contained in:
Joyce Liu 2019-05-29 17:32:31 -07:00 committed by Knative Prow Robot
parent ff9cac1293
commit bcc54bb383
3 changed files with 44 additions and 14 deletions

4
Gopkg.lock generated
View File

@ -116,14 +116,14 @@
[[projects]]
branch = "master"
digest = "1:1bfc083da5bbeb7abaac53c56890eb14eb11bac9ec985bfe338c4bbb0540c9ba"
digest = "1:8cbd2b6c179d93c5cdc5f75c1acda0aa7ef7649cf9ca138e587d9ac98a137802"
name = "github.com/knative/test-infra"
packages = [
"scripts",
"tools/dep-collector",
]
pruneopts = "UT"
revision = "1576da30069624094cf01719452da944b3046826"
revision = "7d0c44fb03a996501f10e3af4a718fd008fe9bed"
[[projects]]
digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6"

View File

@ -257,11 +257,17 @@ function create_test_cluster_with_retries() {
kubetest "$@" ${geoflag}; } 2>&1 | tee ${cluster_creation_log}
# Exit if test succeeded
[[ "$(get_test_return_code)" == "0" ]] && return
# If test failed not because of cluster creation stockout, return
[[ -z "$(grep -Eio 'does not have enough resources available to fulfill' ${cluster_creation_log})" ]] && return
[[ "$(get_test_return_code)" == "0" ]] && return 0
# Retry if cluster creation failed because of:
# - stockout (https://github.com/knative/test-infra/issues/592)
# - latest GKE not available in this region/zone yet (https://github.com/knative/test-infra/issues/694)
[[ -z "$(grep -Fo 'does not have enough resources available to fulfill' ${cluster_creation_log})" \
&& -z "$(grep -Fo 'ResponseError: code=400, message=No valid versions with the prefix' ${cluster_creation_log})" ]] \
&& return 1
done
done
echo "No more region/zones to try, quitting"
return 1
}
# Setup the test cluster for running the tests.
@ -273,7 +279,7 @@ function setup_test_cluster() {
header "Setting up test cluster"
# Set the actual project the test cluster resides in
# It will be a project assigned by Boskos if test is running on Prow,
# It will be a project assigned by Boskos if test is running on Prow,
# otherwise will be ${GCP_PROJECT} set up by user.
readonly export E2E_PROJECT_ID="$(gcloud config get-value project)"
@ -283,6 +289,9 @@ function setup_test_cluster() {
local k8s_user=$(gcloud config get-value core/account)
local k8s_cluster=$(kubectl config current-context)
is_protected_cluster ${k8s_cluster} && \
abort "kubeconfig context set to ${k8s_cluster}, which is forbidden"
# If cluster admin role isn't set, this is a brand new cluster
# Setup the admin role and also KO_DOCKER_REPO
if [[ -z "$(kubectl get clusterrolebinding cluster-admin-binding 2> /dev/null)" ]]; then
@ -305,6 +314,8 @@ function setup_test_cluster() {
set +o pipefail
if (( ! SKIP_KNATIVE_SETUP )) && function_exists knative_setup; then
# Wait for Istio installation to complete, if necessary, before calling knative_setup.
(( ! SKIP_ISTIO_ADDON )) && (wait_until_batch_job_complete istio-system || return 1)
knative_setup || fail_test "Knative setup failed"
fi
if function_exists test_setup; then

View File

@ -18,6 +18,9 @@
# to be used in test scripts and the like. It doesn't do anything when
# called from command line.
# GCP project where all tests related resources live
readonly KNATIVE_TESTS_PROJECT=knative-tests
# Default GKE version to be used with Knative Serving
readonly SERVING_GKE_VERSION=gke-latest
readonly SERVING_GKE_IMAGE=cos
@ -329,7 +332,16 @@ function start_latest_knative_serving() {
header "Starting Knative Serving"
subheader "Installing Knative Serving"
echo "Installing Serving from ${KNATIVE_SERVING_RELEASE}"
kubectl apply -f ${KNATIVE_SERVING_RELEASE} || return 1
# Some CRDs defined in serving YAML are also referenced by other components in serving. As it takes
# time for CRDs to become effective, there is a race condition between when the CRDs are effective
# and when the resources that references those CRDs are created.
# The current workaround is to re-apply serving.yaml if it fails. Remove the retry logic after the
# race condition is fixed. (https://github.com/knative/serving/issues/4176)
if ! kubectl apply -f ${KNATIVE_SERVING_RELEASE}; then
echo "Install failed, waiting 60s and then retrying..."
sleep 60
kubectl apply -f ${KNATIVE_SERVING_RELEASE} || return 1
fi
wait_until_pods_running knative-serving || return 1
}
@ -415,7 +427,20 @@ function is_int() {
# Return whether the given parameter is the knative release/nightly GCF.
# Parameters: $1 - full GCR name, e.g. gcr.io/knative-foo-bar
function is_protected_gcr() {
[[ -n $1 && "$1" =~ "^gcr.io/knative-(releases|nightly)/?$" ]]
[[ -n $1 && $1 =~ ^gcr.io/knative-(releases|nightly)/?$ ]]
}
# Return whether the given parameter is any cluster under ${KNATIVE_TESTS_PROJECT}.
# Parameters: $1 - Kubernetes cluster context (output of kubectl config current-context)
function is_protected_cluster() {
# Example: gke_knative-tests_us-central1-f_prow
[[ -n $1 && $1 =~ ^gke_${KNATIVE_TESTS_PROJECT}_us\-[a-zA-Z0-9]+\-[a-z]+_[a-z0-9\-]+$ ]]
}
# Return whether the given parameter is ${KNATIVE_TESTS_PROJECT}.
# Parameters: $1 - project name
function is_protected_project() {
[[ -n $1 && "$1" == "${KNATIVE_TESTS_PROJECT}" ]]
}
# Remove symlinks in a path that are broken or lead outside the repo.
@ -439,12 +464,6 @@ function remove_broken_symlinks() {
done
}
# Return whether the given parameter is knative-tests.
# Parameters: $1 - project name
function is_protected_project() {
[[ -n "$1" && "$1" == "knative-tests" ]]
}
# Returns the canonical path of a filesystem object.
# Parameters: $1 - path to return in canonical form
# $2 - base dir for relative links; optional, defaults to current