[master] Auto-update dependencies (#1312)

Produced via:
  `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh`
/assign n3wscott vagababov
/cc n3wscott vagababov
This commit is contained in:
Matt Moore 2020-05-08 08:22:45 -07:00 committed by GitHub
parent 19b1d7b64d
commit b820699d66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 87 additions and 39 deletions

2
go.mod
View File

@ -48,7 +48,7 @@ require (
k8s.io/klog v1.0.0
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a
k8s.io/test-infra v0.0.0-20200407001919-bc7f71ef65b8
knative.dev/test-infra v0.0.0-20200506045344-e71b1288c15c
knative.dev/test-infra v0.0.0-20200508015845-8d7d46a46176
)
replace (

4
go.sum
View File

@ -1350,8 +1350,8 @@ knative.dev/pkg v0.0.0-20200428194351-90fc61bae7f7/go.mod h1:o+e8OVEJKIuvXPsGVPI
knative.dev/pkg v0.0.0-20200505191044-3da93ebb24c2/go.mod h1:Q6sL35DdGs8hIQZKdaCXJGgY8f90BmNBKSb8z6d/BTM=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200506045344-e71b1288c15c h1:GfRICwJBY2VmbzFzu/se73+gsfKEkc83qlTBcohJvN0=
knative.dev/test-infra v0.0.0-20200506045344-e71b1288c15c/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
knative.dev/test-infra v0.0.0-20200508015845-8d7d46a46176 h1:Uab7/fRKm5lujDe+DorXGTA1v5ACzZ1wUwhcIvqcNjI=
knative.dev/test-infra v0.0.0-20200508015845-8d7d46a46176/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k=

View File

@ -26,7 +26,7 @@ readonly SERVING_GKE_VERSION=gke-latest
readonly SERVING_GKE_IMAGE=cos
# Conveniently set GOPATH if unset
if [[ -z "${GOPATH:-}" ]]; then
if [[ ! -v GOPATH ]]; then
export GOPATH="$(go env GOPATH)"
if [[ -z "${GOPATH}" ]]; then
echo "WARNING: GOPATH not set and go binary unable to provide it"
@ -34,9 +34,9 @@ if [[ -z "${GOPATH:-}" ]]; then
fi
# Useful environment variables
[[ -n "${PROW_JOB_ID:-}" ]] && IS_PROW=1 || IS_PROW=0
[[ -v PROW_JOB_ID ]] && IS_PROW=1 || IS_PROW=0
readonly IS_PROW
[[ -z "${REPO_ROOT_DIR:-}" ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
readonly REPO_ROOT_DIR
readonly REPO_NAME="$(basename ${REPO_ROOT_DIR})"
@ -389,8 +389,25 @@ function mktemp_with_extension() {
# $2 - check name as an identifier (e.g., GoBuild)
# $3 - failure message (can contain newlines), optional (means success)
function create_junit_xml() {
local xml="$(mktemp_with_extension "${ARTIFACTS}"/junit_XXXXXXXX xml)"
run_kntest junit --suite="$1" --name="$2" --err-msg="$3" --dest="${xml}" || return 1
local xml="$(mktemp_with_extension ${ARTIFACTS}/junit_XXXXXXXX xml)"
local failure=""
if [[ "$3" != "" ]]; then
# Transform newlines into HTML code.
# Also escape `<` and `>` as here: https://github.com/golang/go/blob/50bd1c4d4eb4fac8ddeb5f063c099daccfb71b26/src/encoding/json/encode.go#L48,
# this is temporary solution for fixing https://github.com/knative/test-infra/issues/1204,
# which should be obsolete once Test-infra 2.0 is in place
local msg="$(echo -n "$3" | sed 's/$/\&#xA;/g' | sed 's/</\\u003c/' | sed 's/>/\\u003e/' | sed 's/&/\\u0026/' | tr -d '\n')"
failure="<failure message=\"Failed\" type=\"\">${msg}</failure>"
fi
cat << EOF > "${xml}"
<testsuites>
<testsuite tests="1" failures="1" time="0.000" name="$1">
<testcase classname="" name="$2" time="0.0">
${failure}
</testcase>
</testsuite>
</testsuites>
EOF
}
# Runs a go test and generate a junit summary.
@ -499,24 +516,19 @@ function start_latest_knative_eventing() {
function run_go_tool() {
local tool=$2
local install_failed=0
local action="get"
[[ $1 =~ ^[\./].* ]] && action="install"
# Install the tool in the following situations:
# - The tool does not exist.
# - The tool needs to be installed from a local path.
# - Version of the tool is specificied in the given tool path.
# TODO(chizhg): derive a better versioning story for the tools being used.
if [[ -z "$(which "${tool}")" || "${action}" == "install" || "${tool}" =~ "@" ]]; then
if [[ -z "$(which ${tool})" ]]; then
local action=get
[[ $1 =~ ^[\./].* ]] && action=install
# Avoid running `go get` from root dir of the repository, as it can change go.sum and go.mod files.
# See discussions in https://github.com/golang/go/issues/27643.
if [[ ${action} == "get" && $(pwd) == "${REPO_ROOT_DIR}" ]]; then
local temp_dir="$(mktemp -d)"
# Swallow the output as we are returning the stdout in the end.
pushd "${temp_dir}" > /dev/null 2>&1
GOFLAGS="" go ${action} $1 || install_failed=1
GOFLAGS="" go ${action} "$1" || install_failed=1
popd > /dev/null 2>&1
else
GOFLAGS="" go ${action} $1 || install_failed=1
GOFLAGS="" go ${action} "$1" || install_failed=1
fi
fi
(( install_failed )) && return ${install_failed}
@ -524,17 +536,6 @@ function run_go_tool() {
${tool} "$@"
}
# Run "kntest" tool
# Parameters: $1..$n - parameters passed to the tool
function run_kntest() {
if [[ "${REPO_NAME}" == "test-infra" ]]; then
go run "${REPO_ROOT_DIR}"/kntest/cmd/kntest "$@"
else
# Always run the latest version.
run_go_tool knative.dev/test-infra/kntest/cmd/kntest@master "$@"
fi
}
# Run go-licenses to update licenses.
# Parameters: $1 - output file, relative to repo root dir.
# $2 - directory to inspect.
@ -652,6 +653,21 @@ function get_canonical_path() {
echo "$(cd ${path%/*} && echo $PWD/${path##*/})"
}
# List changed files in the current PR.
# This is implemented as a function so it can be mocked in unit tests.
# It will fail if a file name ever contained a newline character (which is bad practice anyway)
function list_changed_files() {
if [[ -v PULL_BASE_SHA ]] && [[ -v PULL_PULL_SHA ]]; then
# Avoid warning when there are more than 1085 files renamed:
# https://stackoverflow.com/questions/7830728/warning-on-diff-renamelimit-variable-when-doing-git-push
git config diff.renames 0
git --no-pager diff --name-only ${PULL_BASE_SHA}..${PULL_PULL_SHA}
else
# Do our best if not running in Prow
git diff --name-only HEAD^
fi
}
# Returns the current branch.
function current_branch() {
local branch_name=""
@ -694,6 +710,29 @@ function get_latest_knative_yaml_source() {
echo "https://storage.googleapis.com/knative-nightly/${repo_name}/latest/${yaml_name}.yaml"
}
function shellcheck_new_files() {
declare -a array_of_files
local failed=0
readarray -t -d '\n' array_of_files < <(list_changed_files)
for filename in "${array_of_files[@]}"; do
if echo "${filename}" | grep -q "^vendor/"; then
continue
fi
if file "${filename}" | grep -q "shell script"; then
# SC1090 is "Can't follow non-constant source"; we will scan files individually
if shellcheck -e SC1090 "${filename}"; then
echo "--- PASS: shellcheck on ${filename}"
else
echo "--- FAIL: shellcheck on ${filename}"
failed=1
fi
fi
done
if [[ ${failed} -eq 1 ]]; then
fail_script "shellcheck failures"
fi
}
# Initializations that depend on previous functions.
# These MUST come last.

View File

@ -46,15 +46,6 @@ function pr_only_contains() {
[[ -z "$(echo "${CHANGED_FILES}" | grep -v "\(${1// /\\|}\)$")" ]]
}
# List changed files in the current PR.
# This is implemented as a function so it can be mocked in unit tests.
function list_changed_files() {
# Avoid warning when there are more than 1085 files renamed:
# https://stackoverflow.com/questions/7830728/warning-on-diff-renamelimit-variable-when-doing-git-push
git config diff.renames 0
git --no-pager diff --name-only ${PULL_BASE_SHA}..${PULL_SHA}
}
# Initialize flags and context for presubmit tests:
# CHANGED_FILES, IS_PRESUBMIT_EXEMPT_PR and IS_DOCUMENTATION_PR.
function initialize_environment() {

View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
source "$(dirname "${BASH_SOURCE[0]}")/library.sh"
if (( ! IS_PROW )); then
echo "Local run of shellcheck-presubmit detected"
echo "This notably DOES NOT ACT LIKE THE GITHUB PRESUBMIT"
echo "The Github presubmit job only runs shellcheck on files you touch"
echo "There's no way to locally determine which files you touched:"
echo " as git is a distributed VCS, there is no notion of parent until merge"
echo " is attempted."
echo "So it checks the current content of all files changed in the previous commit"
echo " and/or currently staged."
fi
shellcheck_new_files

2
vendor/modules.txt vendored
View File

@ -914,7 +914,7 @@ k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/pointer
k8s.io/utils/trace
# knative.dev/test-infra v0.0.0-20200506045344-e71b1288c15c
# knative.dev/test-infra v0.0.0-20200508015845-8d7d46a46176
## explicit
knative.dev/test-infra/scripts
# sigs.k8s.io/yaml v1.1.0