diff --git a/Gopkg.lock b/Gopkg.lock index 81597fe9ee3..ed867edd90a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -472,14 +472,14 @@ [[projects]] branch = "master" - digest = "1:f3c8dc03bb88bca90c59550e06b0f27a6ca489b1747ac8e5153686a6752e4d74" + digest = "1:e52814856d1182e3f80db2dbab1b2888f1d7c486a9094ebc27aa18d241e43a08" name = "github.com/knative/test-infra" packages = [ "scripts", "tools/dep-collector", ] pruneopts = "UT" - revision = "3a09cd7f5428743509941d116fdee644041a3507" + revision = "6a4119d87d5e494fe74b17d096db3e5aca57361c" [[projects]] digest = "1:56dbf15e091bf7926cb33a57cb6bdfc658fc6d3498d2f76f10a97ce7856f1fde" diff --git a/vendor/github.com/knative/test-infra/scripts/README.md b/vendor/github.com/knative/test-infra/scripts/README.md index b33543080e9..06cff45e003 100644 --- a/vendor/github.com/knative/test-infra/scripts/README.md +++ b/vendor/github.com/knative/test-infra/scripts/README.md @@ -155,8 +155,9 @@ This is a helper script for Knative E2E test scripts. To use it: 1. Write logic for the end-to-end tests. Run all go tests using `go_test_e2e()` (or `report_go_test()` if you need a more fine-grained control) and call `fail_test()` or `success()` if any of them failed. The environment variable - `KO_DOCKER_REPO` will be set according to the test cluster. You can also use - the following boolean (0 is false, 1 is true) environment variables for the logic: + `KO_DOCKER_REPO` and `E2E_PROJECT_ID` will be set according to the test cluster. + You can also use the following boolean (0 is false, 1 is true) environment + variables for the logic: - `EMIT_METRICS`: true if `--emit-metrics` was passed. diff --git a/vendor/github.com/knative/test-infra/scripts/e2e-tests.sh b/vendor/github.com/knative/test-infra/scripts/e2e-tests.sh index e0c949cc43d..868b36d7eb9 100755 --- a/vendor/github.com/knative/test-infra/scripts/e2e-tests.sh +++ b/vendor/github.com/knative/test-infra/scripts/e2e-tests.sh @@ -67,6 +67,8 @@ IS_BOSKOS=0 # Tear down the test resources. function teardown_test_resources() { + # On boskos, save time and don't teardown as the cluster will be destroyed anyway. + (( IS_BOSKOS )) && return header "Tearing down test environment" function_exists test_teardown && test_teardown (( ! SKIP_KNATIVE_SETUP )) && function_exists knative_teardown && knative_teardown @@ -113,8 +115,7 @@ function save_metadata() { geo_key="Zone" geo_value="${E2E_CLUSTER_REGION}-${E2E_CLUSTER_ZONE}" fi - local gcloud_project="$(gcloud config get-value project)" - local cluster_version="$(gcloud container clusters list --project=${gcloud_project} --format='value(currentMasterVersion)')" + local cluster_version="$(gcloud container clusters list --project=${E2E_PROJECT_ID} --format='value(currentMasterVersion)')" cat << EOF > ${ARTIFACTS}/metadata.json { "E2E:${geo_key}": "${geo_value}", @@ -130,6 +131,7 @@ EOF # See https://github.com/knative/serving/issues/959 for details. # TODO(adrcunha): Remove once the leak issue is resolved. function delete_leaked_network_resources() { + # On boskos, don't bother with leaks as the janitor will delete everything in the project. (( IS_BOSKOS )) && return # Ensure we're using the GCP project used by kubetest local gcloud_project="$(gcloud config get-value project)" @@ -269,6 +271,11 @@ 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, + # otherwise will be ${GCP_PROJECT} set up by user. + readonly export E2E_PROJECT_ID="$(gcloud config get-value project)" + # Save some metadata about cluster creation for using in prow and testgrid save_metadata @@ -280,9 +287,10 @@ function setup_test_cluster() { if [[ -z "$(kubectl get clusterrolebinding cluster-admin-binding 2> /dev/null)" ]]; then acquire_cluster_admin_role ${k8s_user} ${E2E_CLUSTER_NAME} ${E2E_CLUSTER_REGION} ${E2E_CLUSTER_ZONE} kubectl config set-context ${k8s_cluster} --namespace=default - export KO_DOCKER_REPO=gcr.io/$(gcloud config get-value project)/${E2E_BASE_NAME}-e2e-img + export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${E2E_BASE_NAME}-e2e-img fi + echo "- Project is ${E2E_PROJECT_ID}" echo "- Cluster is ${k8s_cluster}" echo "- User is ${k8s_user}" echo "- Docker is ${KO_DOCKER_REPO}" @@ -303,7 +311,7 @@ function setup_test_cluster() { fi } -# Gets the exit of of the test script. +# Gets the exit of the test script. # For more details, see set_test_return_code(). function get_test_return_code() { echo $(cat ${TEST_RESULT_FILE}) diff --git a/vendor/github.com/knative/test-infra/scripts/presubmit-tests.sh b/vendor/github.com/knative/test-infra/scripts/presubmit-tests.sh index b10a8515cfc..3f15cf3abaf 100755 --- a/vendor/github.com/knative/test-infra/scripts/presubmit-tests.sh +++ b/vendor/github.com/knative/test-infra/scripts/presubmit-tests.sh @@ -43,7 +43,7 @@ IS_DOCUMENTATION_PR=0 # Returns true if PR only contains the given file regexes. # Parameters: $1 - file regexes, space separated. function pr_only_contains() { - [[ -z "$(echo "${CHANGED_FILES}" | grep -v \(${1// /\\|}\)$))" ]] + [[ -z "$(echo "${CHANGED_FILES}" | grep -v "\(${1// /\\|}\)$")" ]] } # List changed files in the current PR.