forked from knative/serving
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade to latest dependencies (knative#13147)
bumping knative.dev/networking 1f4c9ce...cddb0ff: > cddb0ff Stop using knative.dev/pkg/pool, use errgroup instead (# 695) bumping knative.dev/hack a645040...782bbaa: > 782bbaa drop warning (# 204) > 92c7e36 Fix the buoy invocation (# 203) > 123a278 🧹 Migrate to using the `go run` instead of `go install` (# 172) bumping knative.dev/pkg 3764d73...6c9c1c6: > 6c9c1c6 remove defunct markdown linting variable (# 2552) bumping golang.org/x/sync 0de741c...886fb93: > 886fb93 A+C: delete AUTHORS and CONTRIBUTORS bumping knative.dev/caching 9d082ff...783e336: > 783e336 upgrade to latest dependencies (# 661) Signed-off-by: Knative Automation <[email protected]>
- Loading branch information
1 parent
808923d
commit 2a22c44
Showing
10 changed files
with
91 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ fi | |
readonly IS_PROW | ||
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)" | ||
readonly REPO_ROOT_DIR | ||
readonly REPO_NAME="$(basename ${REPO_ROOT_DIR})" | ||
readonly REPO_NAME="${REPO_NAME:-$(basename "${REPO_ROOT_DIR}")}" | ||
|
||
# Useful flags about the current OS | ||
IS_LINUX=0 | ||
|
@@ -56,10 +56,15 @@ readonly IS_LINUX | |
readonly IS_OSX | ||
readonly IS_WINDOWS | ||
|
||
export TMPDIR="${TMPDIR:-$(mktemp -u -t -d knative.XXXXXXXX)}" | ||
mkdir -p "$TMPDIR" | ||
# Set ARTIFACTS to an empty temp dir if unset | ||
if [[ -z "${ARTIFACTS:-}" ]]; then | ||
export ARTIFACTS="$(mktemp -d)" | ||
ARTIFACTS="$(mktemp -u -t -d)" | ||
export ARTIFACTS | ||
fi | ||
mkdir -p "$ARTIFACTS" | ||
|
||
|
||
# On a Prow job, redirect stderr to stdout so it's synchronously added to log | ||
(( IS_PROW )) && exec 2>&1 | ||
|
@@ -429,45 +434,46 @@ function mktemp_with_extension() { | |
function create_junit_xml() { | ||
local xml | ||
xml="$(mktemp_with_extension "${ARTIFACTS}"/junit_XXXXXXXX xml)" | ||
echo "JUnit file ${xml} is created for reporting the test result" | ||
echo "XML report for $1::$2 written to ${xml}" | ||
run_kntest junit --suite="$1" --name="$2" --err-msg="$3" --dest="${xml}" || return 1 | ||
} | ||
|
||
# Runs a go test and generate a junit summary. | ||
# Parameters: $1... - parameters to go test | ||
function report_go_test() { | ||
local go_test_args=( "$@" ) | ||
# Install gotestsum if necessary. | ||
run_go_tool gotest.tools/gotestsum gotestsum --help > /dev/null 2>&1 | ||
# Capture the test output to the report file. | ||
local report | ||
report="$(mktemp)" | ||
local xml | ||
local logfile xml ansilog htmllog | ||
xml="$(mktemp_with_extension "${ARTIFACTS}"/junit_XXXXXXXX xml)" | ||
# Keep the suffix, so files are related. | ||
logfile="${xml/junit_/go_test_}" | ||
logfile="${logfile/.xml/.jsonl}" | ||
echo "Running go test with args: ${go_test_args[*]}" | ||
capture_output "${report}" gotestsum --format "${GO_TEST_VERBOSITY:-testname}" \ | ||
--junitfile "${xml}" --junitfile-testsuite-name relative --junitfile-testcase-classname relative \ | ||
go_run gotest.tools/[email protected] \ | ||
--format "${GO_TEST_VERBOSITY:-testname}" \ | ||
--junitfile "${xml}" \ | ||
--junitfile-testsuite-name relative \ | ||
--junitfile-testcase-classname relative \ | ||
--jsonfile "${logfile}" \ | ||
-- "${go_test_args[@]}" | ||
local failed=$? | ||
echo "Finished run, return code is ${failed}" | ||
local gotest_retcode=$? | ||
echo "Finished run, return code is ${gotest_retcode}" | ||
|
||
echo "XML report written to ${xml}" | ||
if [[ -n "$(grep '<testsuites></testsuites>' "${xml}")" ]]; then | ||
# XML report is empty, something's wrong; use the output as failure reason | ||
create_junit_xml _go_tests "GoTests" "$(cat "${report}")" | ||
fi | ||
# Capture and report any race condition errors | ||
local race_errors | ||
race_errors="$(sed -n '/^WARNING: DATA RACE$/,/^==================$/p' "${report}")" | ||
create_junit_xml _go_tests "DataRaceAnalysis" "${race_errors}" | ||
if (( ! IS_PROW )); then | ||
# Keep the suffix, so files are related. | ||
local logfile=${xml/junit_/go_test_} | ||
logfile=${logfile/.xml/.log} | ||
cp "${report}" "${logfile}" | ||
echo "Test log written to ${logfile}" | ||
fi | ||
return ${failed} | ||
echo "Test log (JSONL) written to ${logfile}" | ||
|
||
ansilog="${logfile/.jsonl/-ansi.log}" | ||
go_run github.com/haveyoudebuggedit/gotestfmt/v2/cmd/[email protected] \ | ||
-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/[email protected] \ | ||
--preview < "$ansilog" > "$htmllog" | ||
echo "Test log (HTML) written to ${htmllog}" | ||
|
||
return ${gotest_retcode} | ||
} | ||
|
||
# Install Knative Serving in the current cluster. | ||
|
@@ -543,24 +549,41 @@ function start_latest_eventing_sugar_controller() { | |
start_knative_eventing_extension "${KNATIVE_EVENTING_SUGAR_CONTROLLER_RELEASE}" "knative-eventing" | ||
} | ||
|
||
# Run a go utility without installing it. | ||
# Parameters: $1 - tool package for go run. | ||
# $2..$n - parameters passed to the tool. | ||
function go_run() { | ||
local package | ||
package="$1" | ||
if [[ "$package" != *@* ]]; then | ||
abort 'Package for "go_run" needs to have @version' | ||
fi | ||
shift 1 | ||
GORUN_PATH="${GORUN_PATH:-$(go env GOPATH)}" | ||
# Some CI environments may have non-writable GOPATH | ||
if ! [ -w "${GORUN_PATH}" ]; then | ||
GORUN_PATH="$(mktemp -t -d -u gopath.XXXXXXXX)" | ||
fi | ||
export GORUN_PATH | ||
GOPATH="${GORUN_PATH}" \ | ||
GOFLAGS='' \ | ||
GO111MODULE='' \ | ||
go run "$package" "$@" | ||
} | ||
|
||
# Run a go tool, installing it first if necessary. | ||
# Parameters: $1 - tool package/dir for go install. | ||
# $2 - tool to run. | ||
# $3..$n - parameters passed to the tool. | ||
# Deprecated: use go_run instead | ||
function run_go_tool() { | ||
local package=$1 | ||
local tool=$2 | ||
local install_failed=0 | ||
# If no `@version` is provided, default to adding `@latest` | ||
if [[ "$package" != *@* ]]; then | ||
package=$package@latest | ||
fi | ||
if [[ -z "$(which ${tool})" ]]; then | ||
GOFLAGS="" go install "$package" || install_failed=1 | ||
fi | ||
(( install_failed )) && return ${install_failed} | ||
shift 2 | ||
${tool} "$@" | ||
go_run "$package" "$@" | ||
} | ||
|
||
# Add function call to trap | ||
|
@@ -623,7 +646,7 @@ function go_update_deps() { | |
else | ||
group "Upgrading to release ${RELEASE}" | ||
fi | ||
FLOATING_DEPS+=( $(run_go_tool knative.dev/test-infra/buoy buoy float ${REPO_ROOT_DIR}/go.mod "${buoyArgs[@]}") ) | ||
FLOATING_DEPS+=( $(go_run knative.dev/test-infra/buoy@latest float ${REPO_ROOT_DIR}/go.mod "${buoyArgs[@]}") ) | ||
if [[ ${#FLOATING_DEPS[@]} > 0 ]]; then | ||
echo "Floating deps to ${FLOATING_DEPS[@]}" | ||
go get -d ${FLOATING_DEPS[@]} | ||
|
@@ -684,13 +707,10 @@ function go_mod_gopath_hack() { | |
echo "${TMP_DIR}" | ||
} | ||
|
||
# Run kntest tool, error out and ask users to install it if it's not currently installed. | ||
# Run kntest tool | ||
# Parameters: $1..$n - parameters passed to the tool. | ||
function run_kntest() { | ||
if [[ ! -x "$(command -v kntest)" ]]; then | ||
echo "--- FAIL: kntest not installed, please clone knative test-infra repo and run \`go install ./tools/kntest/cmd/kntest\` to install it"; return 1; | ||
fi | ||
kntest "$@" | ||
go_run knative.dev/test-infra/tools/kntest/cmd/kntest@latest "$@" | ||
} | ||
|
||
# Run go-licenses to update licenses. | ||
|
@@ -701,14 +721,16 @@ function update_licenses() { | |
local dst=$1 | ||
local dir=$2 | ||
shift | ||
run_go_tool github.com/google/go-licenses go-licenses save "${dir}" --save_path="${dst}" --force || \ | ||
go_run github.com/google/[email protected] \ | ||
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. | ||
run_go_tool github.com/google/go-licenses go-licenses check "${REPO_ROOT_DIR}/..." || \ | ||
go_run github.com/google/[email protected] \ | ||
check "${REPO_ROOT_DIR}/..." || \ | ||
{ echo "--- FAIL: go-licenses failed the license check"; return 1; } | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters