Skip to content

Commit

Permalink
upgrade to latest dependencies
Browse files Browse the repository at this point in the history
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 🐛 Remove deps from go.mod for knative.dev/hack (# 320)
  > 34850cd Update community files (# 319)
  > da6e74c 🐛 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 🎁 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 <automation@knative.team>
  • Loading branch information
knative-automation committed Sep 26, 2023
1 parent 8a72ba9 commit af1f363
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 73 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
9 changes: 2 additions & 7 deletions vendor/knative.dev/hack/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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" )
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
1 change: 1 addition & 0 deletions vendor/knative.dev/hack/go.work
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ use (
.
schema
test
test/vendorproj
)
12 changes: 0 additions & 12 deletions vendor/knative.dev/hack/go.work.sum

This file was deleted.

41 changes: 31 additions & 10 deletions vendor/knative.dev/hack/infra-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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[@]}"
}
68 changes: 46 additions & 22 deletions vendor/knative.dev/hack/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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}"

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
)
}

Expand Down Expand Up @@ -788,15 +812,15 @@ 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; }
}

# 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; }
}
Expand Down
16 changes: 10 additions & 6 deletions vendor/knative.dev/hack/performance-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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}"
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/hack/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit af1f363

Please sign in to comment.