From af1f36331309f33deed8ea2c72bd728100167478 Mon Sep 17 00:00:00 2001 From: Knative Automation Date: Tue, 26 Sep 2023 03:30:46 +0000 Subject: [PATCH] upgrade to latest dependencies bumping knative.dev/client-pkg 5abd129...9574adc: > 9574adc Update community files (# 119) > b21a925 Update community files (# 118) > 2bcbd97 Update community files (# 117) bumping knative.dev/hack a75befb...46659bc: > 46659bc Update actions (# 323) > 403114f Manual shellcheck (# 321) > 74aa02a :bug: Remove deps from go.mod for knative.dev/hack (# 320) > 34850cd Update community files (# 319) > da6e74c :bug: The `go.work.sum` don't influence the dependencies resolution (# 317) > c4a34c3 Collect LICENSE files from all dependencies, even without vendor dir (# 316) > 38316f2 Upgrade the Go tools to latest ones (# 312) > 0bb79ff Update community files (# 314) > 3af329f Update community files (# 313) > 760813a Allow to not vendor the dependencies (# 311) > f63d16e :gift: Source embedded hack scripts (# 222) > 9cc05a3 Deprecate calling kubetest2 via kntest (# 230) > 044c02b Update community files (# 309) > 3403e35 Update e2e-kind.sh (# 308) > ab12e24 Update community files (# 306) Signed-off-by: Knative Automation --- go.mod | 4 +- go.sum | 8 +-- vendor/knative.dev/hack/e2e-tests.sh | 9 +-- vendor/knative.dev/hack/{hack.go => embed.go} | 15 ++-- vendor/knative.dev/hack/go.work | 1 + vendor/knative.dev/hack/go.work.sum | 12 ---- vendor/knative.dev/hack/infra-library.sh | 41 ++++++++--- vendor/knative.dev/hack/library.sh | 68 +++++++++++++------ vendor/knative.dev/hack/performance-tests.sh | 16 +++-- vendor/knative.dev/hack/presubmit-tests.sh | 2 +- vendor/modules.txt | 4 +- 11 files changed, 107 insertions(+), 73 deletions(-) rename vendor/knative.dev/hack/{hack.go => embed.go} (74%) delete mode 100644 vendor/knative.dev/hack/go.work.sum diff --git a/go.mod b/go.mod index 81a7f5e..16c6b2e 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.18 require ( github.com/spf13/cobra v1.6.0 gotest.tools/v3 v3.3.0 - knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b - knative.dev/hack v0.0.0-20230807013713-a75befb4fd4b + knative.dev/client-pkg v0.0.0-20230922151304-9574adcd11f4 + knative.dev/hack v0.0.0-20230926013247-46659bcc46aa ) require ( diff --git a/go.sum b/go.sum index bd7a036..fdbdf52 100644 --- a/go.sum +++ b/go.sum @@ -37,7 +37,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.3.0 h1:MfDY1b1/0xN1CyMlQDac0ziEy9zJQd9CXBRRDHw2jJo= gotest.tools/v3 v3.3.0/go.mod h1:Mcr9QNxkg0uMvy/YElmo4SpXgJKWgQvYrT7Kw5RzJ1A= -knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b h1:Ln3mDUER89kC4sYHkCpoZVcwthGlMwjekQi2IdMH4vU= -knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b/go.mod h1:GRVZm1rKOy0lpPBGRM1ugK5joDbhXFEvULINHqPoA9U= -knative.dev/hack v0.0.0-20230807013713-a75befb4fd4b h1:hTzjunYC5vIXNG7zehR2CwdwIWrnaPIXNW5y190Xc34= -knative.dev/hack v0.0.0-20230807013713-a75befb4fd4b/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= +knative.dev/client-pkg v0.0.0-20230922151304-9574adcd11f4 h1:Xv+ju2TctFdmkCZSO1wCAik846wPHsImsIou53obWeM= +knative.dev/client-pkg v0.0.0-20230922151304-9574adcd11f4/go.mod h1:GRVZm1rKOy0lpPBGRM1ugK5joDbhXFEvULINHqPoA9U= +knative.dev/hack v0.0.0-20230926013247-46659bcc46aa h1:P5wVR7my+I+hifzjJX8MWKGqhsd2vcjziaqxmggkK3g= +knative.dev/hack v0.0.0-20230926013247-46659bcc46aa/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q= diff --git a/vendor/knative.dev/hack/e2e-tests.sh b/vendor/knative.dev/hack/e2e-tests.sh index 96290f9..331511c 100644 --- a/vendor/knative.dev/hack/e2e-tests.sh +++ b/vendor/knative.dev/hack/e2e-tests.sh @@ -19,8 +19,6 @@ source "$(dirname "${BASH_SOURCE[0]:-$0}")/infra-library.sh" -readonly TEST_RESULT_FILE=/tmp/${REPO_NAME}-e2e-result - # Tear down the test resources. function teardown_test_resources() { header "Tearing down test environment" @@ -133,6 +131,7 @@ E2E_SCRIPT="" function initialize() { local run_tests=0 local custom_flags=() + local extra_gcloud_flags=() local parse_script_flags=0 E2E_SCRIPT="$(get_canonical_path "$0")" local e2e_script_command=( "${E2E_SCRIPT}" "--run-tests" ) @@ -177,16 +176,12 @@ function initialize() { shift done - if [[ "${CLOUD_PROVIDER}" == "gke" ]]; then - custom_flags+=("--addons=NodeLocalDNS") - fi - readonly SKIP_DUMP_ON_FAILURE readonly TEARDOWN readonly CLOUD_PROVIDER if (( ! run_tests )); then - create_test_cluster "${CLOUD_PROVIDER}" custom_flags e2e_script_command + create_test_cluster "${CLOUD_PROVIDER}" custom_flags extra_gcloud_flags e2e_script_command else setup_test_cluster fi diff --git a/vendor/knative.dev/hack/hack.go b/vendor/knative.dev/hack/embed.go similarity index 74% rename from vendor/knative.dev/hack/hack.go rename to vendor/knative.dev/hack/embed.go index 25603fc..62f856e 100644 --- a/vendor/knative.dev/hack/hack.go +++ b/vendor/knative.dev/hack/embed.go @@ -1,8 +1,5 @@ -//go:build hack -// +build hack - /* -Copyright 2020 The Knative Authors +Copyright 2022 The Knative Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -17,7 +14,11 @@ See the License for the specific language governing permissions and limitations under the License. */ -// package hack is a collection of scripts used to bootstrap CI processes and -// other vital entrypoint functionality. - package hack + +import ( + "embed" +) + +//go:embed *.sh +var Scripts embed.FS diff --git a/vendor/knative.dev/hack/go.work b/vendor/knative.dev/hack/go.work index d9a0de8..b6265ad 100644 --- a/vendor/knative.dev/hack/go.work +++ b/vendor/knative.dev/hack/go.work @@ -4,4 +4,5 @@ use ( . schema test + test/vendorproj ) diff --git a/vendor/knative.dev/hack/go.work.sum b/vendor/knative.dev/hack/go.work.sum deleted file mode 100644 index cd1e582..0000000 --- a/vendor/knative.dev/hack/go.work.sum +++ /dev/null @@ -1,12 +0,0 @@ -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -k8s.io/apimachinery v0.20.6 h1:R5p3SlhaABYShQSO6LpPsYHjV05Q+79eBUR0Ut/f4tk= -k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= -k8s.io/klog/v2 v2.4.0 h1:7+X0fUguPyrKEC4WjH8iGDg3laWgMo5tMnRTIGTTxGQ= -sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 h1:zD2IemQ4LmOcAumeiyDWXKUI2SO0NYDe3H6QGvPOVgU= -sigs.k8s.io/structured-merge-diff/v4 v4.0.3 h1:4oyYo8NREp49LBBhKxEqCulFjg26rawYKrnCmg+Sr6c= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= diff --git a/vendor/knative.dev/hack/infra-library.sh b/vendor/knative.dev/hack/infra-library.sh index 84a87e2..adc37ef 100644 --- a/vendor/knative.dev/hack/infra-library.sh +++ b/vendor/knative.dev/hack/infra-library.sh @@ -91,7 +91,7 @@ function create_test_cluster() { fi case "$1" in - gke) create_gke_test_cluster "$2" "$3" "${4:-}" ;; + gke) create_gke_test_cluster "$2" "$3" "$4" "${5:-}" ;; kind) create_kind_test_cluster "$2" "$3" "${4:-}" ;; *) echo "unsupported provider: $1"; exit 1 ;; esac @@ -117,29 +117,50 @@ function create_kind_test_cluster() { } # Create a GKE test cluster with kubetest2 and run the test command. -# Parameters: $1 - custom flags defined in kntest -# $2 - test command to run after the cluster is created (optional) +# Parameters: $1 - custom flags defined in kubetest2 +# $2 - custom flags to pass directly to gcloud +# $3 - test command to run after the cluster is created (optional) function create_gke_test_cluster() { local -n _custom_flags=$1 - local -n _test_command=$2 + local -n _extra_gcloud_flags=$2 + local -n _test_command=$3 # We are disabling logs and metrics on Boskos Clusters by default as they are not used. Manually set ENABLE_GKE_TELEMETRY to true to enable telemetry # and ENABLE_PREEMPTIBLE_NODES to true to create preemptible/spot VMs. VM Preemption is a rare event and shouldn't be distruptive given the fault tolerant nature of our tests. - local extra_gcloud_flags="" if [[ "${ENABLE_GKE_TELEMETRY:-}" != "true" ]]; then - extra_gcloud_flags="${extra_gcloud_flags} --logging=NONE --monitoring=NONE" + _extra_gcloud_flags+=("--logging=NONE --monitoring=NONE") + fi + + if [[ "${CLOUD_PROVIDER}" == "gke" ]]; then + extra_gcloud_flags+=("--addons=NodeLocalDNS") fi if [[ "${ENABLE_PREEMPTIBLE_NODES:-}" == "true" ]]; then - extra_gcloud_flags="${extra_gcloud_flags} --preemptible" + _extra_gcloud_flags+=("--preemptible") fi + + _extra_gcloud_flags+=("--quiet") if ! command -v kubetest2 >/dev/null; then tmpbin="$(mktemp -d)" echo "kubetest2 not found, installing in temp path: ${tmpbin}" GOBIN="$tmpbin" go install sigs.k8s.io/kubetest2/...@latest export PATH="${tmpbin}:${PATH}" fi - run_kntest kubetest2 gke "${_custom_flags[@]}" \ - --test-command="${_test_command[*]}" \ - --extra-gcloud-flags="${extra_gcloud_flags}" + if [[ ! " ${_custom_flags[*]} " =~ "--machine-type=" ]]; then + _custom_flags+=("--machine-type=e2-standard-4") + fi + kubetest2 gke "${_custom_flags[@]}" \ + --rundir-in-artifacts \ + --up \ + --down \ + --boskos-heartbeat-interval-seconds=20 \ + --v=1 \ + --network=e2e-network \ + --boskos-acquire-timeout-seconds=1200 \ + --region="${E2E_CLUSTER_REGION:-us-central1},us-east1,us-west1" \ + --gcloud-extra-flags="${_extra_gcloud_flags[*]}" \ + --retryable-error-patterns='.*does not have enough resources available to fulfill.*,.*only \\d+ nodes out of \\d+ have registered; this is likely due to Nodes failing to start correctly.*,.*All cluster resources were brought up.+ but: component .+ from endpoint .+ is unhealthy.*' \ + --test=exec \ + -- \ + "${_test_command[@]}" } diff --git a/vendor/knative.dev/hack/library.sh b/vendor/knative.dev/hack/library.sh index 5eab6a8..770b249 100644 --- a/vendor/knative.dev/hack/library.sh +++ b/vendor/knative.dev/hack/library.sh @@ -497,7 +497,7 @@ function report_go_test() { logfile="${logfile/.xml/.jsonl}" echo "Running go test with args: ${go_test_args[*]}" local gotest_retcode=0 - go_run gotest.tools/gotestsum@v1.8.0 \ + go_run gotest.tools/gotestsum@v1.10.1 \ --format "${GO_TEST_VERBOSITY:-testname}" \ --junitfile "${xml}" \ --junitfile-testsuite-name relative \ @@ -510,14 +510,14 @@ function report_go_test() { echo "Test log (JSONL) written to ${logfile}" ansilog="${logfile/.jsonl/-ansi.log}" - go_run github.com/haveyoudebuggedit/gotestfmt/v2/cmd/gotestfmt@v2.3.1 \ + go_run github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@v2.5.0 \ -input "${logfile}" \ -showteststatus \ -nofail > "$ansilog" echo "Test log (ANSI) written to ${ansilog}" htmllog="${logfile/.jsonl/.html}" - go_run github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@v3.6.1 \ + go_run github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@v3.9.1 \ --preview < "$ansilog" > "$htmllog" echo "Test log (HTML) written to ${htmllog}" @@ -672,7 +672,30 @@ function foreach_go_module() { # global env var: FLOATING_DEPS # --upgrade will set GOPROXY to direct unless it is already set. function go_update_deps() { + # The go.work.sum will be truncated if it exists. This is to allow the + # `go mod tidy` to resolve the dependencies, without the influence of the + # sums from the workspace. + __clean_goworksum_if_exists foreach_go_module __go_update_deps_for_module "$@" + __remove_goworksum_if_empty +} + +function __clean_goworksum_if_exists() { + if [ -f "$REPO_ROOT_DIR/go.work.sum" ]; then + echo "=== Cleaning the go.work.sum file" + true > "$REPO_ROOT_DIR/go.work.sum" + fi +} + +function __remove_goworksum_if_empty() { + if [ -f "$REPO_ROOT_DIR/go.work" ]; then + echo "=== Syncing the go workspace" + go work sync + fi + if ! [ -s "$REPO_ROOT_DIR/go.work.sum" ]; then + echo "=== Removing empty go.work.sum" + rm -f "$REPO_ROOT_DIR/go.work.sum" + fi } function __go_update_deps_for_module() { @@ -718,34 +741,35 @@ function __go_update_deps_for_module() { fi fi - group "Go mod tidy and vendor" + group "Go mod tidy" # Prune modules. - local orig_pipefail_opt=$(shopt -p -o pipefail) + local orig_pipefail_opt + orig_pipefail_opt=$(shopt -p -o pipefail) set -o pipefail go mod tidy 2>&1 | grep -v "ignoring symlink" || true - go mod vendor 2>&1 | grep -v "ignoring symlink" || true + if [[ "${FORCE_VENDOR:-false}" == "true" ]] || [ -d vendor ]; then + group "Go mod vendor" + go mod vendor 2>&1 | grep -v "ignoring symlink" || true + fi eval "$orig_pipefail_opt" - if ! [ -d vendor ]; then - return 0 - fi - group "Removing unwanted vendor files" + if [[ "${FORCE_VENDOR:-false}" == "true" ]] || [ -d vendor ]; then + group "Removing unwanted vendor files" + find vendor/ \( -name "OWNERS" \ + -o -name "OWNERS_ALIASES" \ + -o -name "BUILD" \ + -o -name "BUILD.bazel" \ + -o -name "*_test.go" \) -exec rm -f {} + - # Remove unwanted vendor files - find vendor/ \( -name "OWNERS" \ - -o -name "OWNERS_ALIASES" \ - -o -name "BUILD" \ - -o -name "BUILD.bazel" \ - -o -name "*_test.go" \) -exec rm -f {} + + export GOFLAGS=-mod=vendor - export GOFLAGS=-mod=vendor + group "Removing broken symlinks" + remove_broken_symlinks ./vendor + fi group "Updating licenses" update_licenses third_party/VENDOR-LICENSE "./..." - - group "Removing broken symlinks" - remove_broken_symlinks ./vendor ) } @@ -788,7 +812,7 @@ function update_licenses() { local dst=$1 local dir=$2 shift - go_run github.com/google/go-licenses@v1.2.1 \ + go_run github.com/google/go-licenses@v1.6.0 \ save "${dir}" --save_path="${dst}" --force || \ { echo "--- FAIL: go-licenses failed to update licenses"; return 1; } } @@ -796,7 +820,7 @@ function update_licenses() { # Run go-licenses to check for forbidden licenses. function check_licenses() { # Check that we don't have any forbidden licenses. - go_run github.com/google/go-licenses@v1.2.1 \ + go_run github.com/google/go-licenses@v1.6.0 \ check "${REPO_ROOT_DIR}/..." || \ { echo "--- FAIL: go-licenses failed the license check"; return 1; } } diff --git a/vendor/knative.dev/hack/performance-tests.sh b/vendor/knative.dev/hack/performance-tests.sh index 440668d..23e17e5 100644 --- a/vendor/knative.dev/hack/performance-tests.sh +++ b/vendor/knative.dev/hack/performance-tests.sh @@ -17,7 +17,7 @@ # This is a helper script for Knative performance test scripts. # See README.md for instructions on how to use it. -source $(dirname "${BASH_SOURCE[0]}")/library.sh +source "$(dirname "${BASH_SOURCE[0]}")"/library.sh # Configurable parameters. # If not provided, they will fall back to the default values. @@ -76,7 +76,8 @@ EOF update_knative || abort "failed to update knative" fi # get benchmark name from the cluster name - local benchmark_name=$(get_benchmark_name "$1") + local benchmark_name + benchmark_name=$(get_benchmark_name "$1") if function_exists update_benchmark; then update_benchmark "${benchmark_name}" || abort "failed to update benchmark" fi @@ -92,13 +93,16 @@ function get_benchmark_name() { # Update the clusters related to the current repo. function update_clusters() { header "Updating all clusters for ${REPO_NAME}" - local all_clusters=$(gcloud container clusters list --project="${PROJECT_NAME}" --format="csv[no-heading](name,zone)") + local all_clusters + all_clusters=$(gcloud container clusters list --project="${PROJECT_NAME}" --format="csv[no-heading](name,zone)") echo ">> Project contains clusters:" "${all_clusters}" for cluster in ${all_clusters}; do - local name=$(echo "${cluster}" | cut -f1 -d",") + local name + name=$(echo "${cluster}" | cut -f1 -d",") # the cluster name is prefixed with "${REPO_NAME}--", here we should only handle clusters belonged to the current repo [[ ! ${name} =~ ^${REPO_NAME}-- ]] && continue - local zone=$(echo "${cluster}" | cut -f2 -d",") + local zone + zone=$(echo "${cluster}" | cut -f2 -d",") # Update all resources installed on the cluster update_cluster "${name}" "${zone}" @@ -109,7 +113,7 @@ function update_clusters() { # Run the perf-tests tool # Parameters: $1..$n - parameters passed to the tool function run_perf_cluster_tool() { - perf-tests $@ + perf-tests "$@" } # Delete the old clusters belonged to the current repo, and recreate them with the same configuration. diff --git a/vendor/knative.dev/hack/presubmit-tests.sh b/vendor/knative.dev/hack/presubmit-tests.sh index 1c6e5a8..d210dc7 100644 --- a/vendor/knative.dev/hack/presubmit-tests.sh +++ b/vendor/knative.dev/hack/presubmit-tests.sh @@ -17,7 +17,7 @@ # This is a helper script for Knative presubmit test scripts. # See README.md for instructions on how to use it. -source $(dirname "${BASH_SOURCE[0]}")/library.sh +source "$(dirname "${BASH_SOURCE[0]}")"/library.sh # Custom configuration of presubmit tests readonly PRESUBMIT_TEST_FAIL_FAST=${PRESUBMIT_TEST_FAIL_FAST:-0} diff --git a/vendor/modules.txt b/vendor/modules.txt index 2fb3ece..2bb4f1b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -22,9 +22,9 @@ gotest.tools/v3/internal/assert gotest.tools/v3/internal/difflib gotest.tools/v3/internal/format gotest.tools/v3/internal/source -# knative.dev/client-pkg v0.0.0-20230815131440-5abd12981b4b +# knative.dev/client-pkg v0.0.0-20230922151304-9574adcd11f4 ## explicit; go 1.18 knative.dev/client-pkg/pkg/kn/plugin -# knative.dev/hack v0.0.0-20230807013713-a75befb4fd4b +# knative.dev/hack v0.0.0-20230926013247-46659bcc46aa ## explicit; go 1.18 knative.dev/hack