upgrade to latest dependencies (#397)

Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
knative-automation 2020-12-01 17:40:37 -08:00 committed by GitHub
parent 91fb5833c3
commit fc10335afb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 186 additions and 11 deletions

4
go.mod
View File

@ -17,6 +17,6 @@ require (
k8s.io/client-go v0.18.12
k8s.io/code-generator v0.18.12
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
knative.dev/hack v0.0.0-20201120192952-353db687ec5b
knative.dev/pkg v0.0.0-20201125095035-9bf616d2f46a
knative.dev/hack v0.0.0-20201201234937-fddbf732e450
knative.dev/pkg v0.0.0-20201130192436-e5346d90e980
)

6
go.sum
View File

@ -1133,8 +1133,10 @@ k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7Mpm
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/hack v0.0.0-20201120192952-353db687ec5b h1:Lc+AKgwhAZUD98mN++qTHeeaP6FRmS8fcwc/rXkP8G0=
knative.dev/hack v0.0.0-20201120192952-353db687ec5b/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20201125095035-9bf616d2f46a h1:pdJpLaq50mLKrPWYSQgTH2p64Dk7Fq/xID6l0F69cVY=
knative.dev/pkg v0.0.0-20201125095035-9bf616d2f46a/go.mod h1:wXZqP8MXCxb51yNFlecA13BwG7Hk370SWDFWV4dx4ug=
knative.dev/hack v0.0.0-20201201234937-fddbf732e450 h1:IyitWF7OzfunCgE4b9ZsJAeIRoQ6JOyqDrz/19X4iS4=
knative.dev/hack v0.0.0-20201201234937-fddbf732e450/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/pkg v0.0.0-20201130192436-e5346d90e980 h1:44zakwrFjbivCM/YR+ni70e9u1ELtwA7VF1HSmUcj+g=
knative.dev/pkg v0.0.0-20201130192436-e5346d90e980/go.mod h1:wXZqP8MXCxb51yNFlecA13BwG7Hk370SWDFWV4dx4ug=
pgregory.net/rapid v0.3.3/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Copyright 2020 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Setup the env for doing Knative style codegen.
kn_hack_library=${kn_hack_library:-"$(dirname $0)/../vendor/knative.dev/hack/library.sh"}
if [[ -f "$kn_hack_library" ]]; then
source $kn_hack_library
else
echo "this file is intended to be imported from a golang project that vendors knative.dev/hack"
exit
fi
export GOPATH=$(go_mod_gopath_hack)
export MODULE_NAME=$(go_mod_module_name)
export CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
export KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/knative.dev/pkg 2>/dev/null || echo ../pkg)}
chmod +x ${CODEGEN_PKG}/generate-groups.sh
chmod +x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh

View File

@ -98,6 +98,37 @@ function function_exists() {
[[ "$(type -t $1)" == "function" ]]
}
# GitHub Actions aware output grouping.
function group() {
# End the group is there is already a group.
if [ -z ${__GROUP_TRACKER+x} ]; then
export __GROUP_TRACKER="grouping"
trap end_group EXIT
else
end_group
fi
# Start a new group.
start_group "$@"
}
# GitHub Actions aware output grouping.
function start_group() {
if [[ -n ${GITHUB_WORKFLOW:-} ]]; then
echo "::group::$@"
trap end_group EXIT
else
echo "--- $@"
fi
}
# GitHub Actions aware end of output grouping.
function end_group() {
if [[ -n ${GITHUB_WORKFLOW:-} ]]; then
echo "::endgroup::"
fi
}
# Waits until the given object doesn't exist.
# Parameters: $1 - the kind of the object.
# $2 - object's name.
@ -528,7 +559,7 @@ function go_update_deps() {
done
if [[ $UPGRADE == 1 ]]; then
echo "--- Upgrading to ${VERSION}"
group "Upgrading to ${VERSION}"
# From shell parameter expansion:
# ${parameter:+word}
# If parameter is null or unset, nothing is substituted, otherwise the expansion of word is substituted.
@ -548,7 +579,7 @@ function go_update_deps() {
fi
fi
echo "--- Go mod tidy and vendor"
group "Go mod tidy and vendor"
# Prune modules.
local orig_pipefail_opt=$(shopt -p -o pipefail)
@ -557,7 +588,7 @@ function go_update_deps() {
go mod vendor 2>&1 | grep -v "ignoring symlink" || true
eval "$orig_pipefail_opt"
echo "--- Removing unwanted vendor files"
group "Removing unwanted vendor files"
# Remove unwanted vendor files
find vendor/ \( -name "OWNERS" \
@ -568,13 +599,32 @@ function go_update_deps() {
export GOFLAGS=-mod=vendor
echo "--- Updating licenses"
group "Updating licenses"
update_licenses third_party/VENDOR-LICENSE "./..."
echo "--- Removing broken symlinks"
group "Removing broken symlinks"
remove_broken_symlinks ./vendor
}
# Return the go module name of the current module.
# Intended to be used like:
# export MODULE_NAME=$(go_mod_module_name)
function go_mod_module_name() {
go mod graph | cut -d' ' -f 1 | grep -v '@' | head -1
}
# Return a GOPATH to a temp directory. Works around the out-of-GOPATH issues
# for k8s client gen mixed with go mod.
# Intended to be used like:
# export GOPATH=$(go_mod_gopath_hack)
function go_mod_gopath_hack() {
local TMP_DIR="$(mktemp -d)"
local TMP_REPO_PATH="${TMP_DIR}/src/$(go_mod_module_name)"
mkdir -p "$(dirname "${TMP_REPO_PATH}")" && ln -s "${REPO_ROOT_DIR}" "${TMP_REPO_PATH}"
echo "${TMP_DIR}"
}
# Run kntest tool, error out and ask users to install it if it's not currently installed.
# Parameters: $1..$n - parameters passed to the tool.
function run_kntest() {

View File

@ -0,0 +1,89 @@
#!/usr/bin/env bash
# Copyright 2019 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -count argument when running go test
readonly BENCH_RUN_COUNT=${BENCH_RUN_COUNT:-5}
# -benchtime argument when running go test
readonly BENCH_RUN_TIME=${BENCH_RUN_TIME:-5s}
function microbenchmarks_run() {
if [ "$1" != "" ]; then
OUTPUT_FILE="$1"
else
OUTPUT_FILE="${ARTIFACTS:-$(mktemp -d)}/bench-result.txt"
fi
# Run all microbenchmarks
go clean
go test -bench=. -benchtime=$BENCH_RUN_TIME -count=$BENCH_RUN_COUNT -benchmem -run="^$" -v ./... >> "$OUTPUT_FILE" || exit
}
# To run microbenchmarks on your machine and compare your revision with upstream/master:
#
# git fetch upstream
# source microbenchmarks.sh
# microbenchmarks_run_and_compare upstream/master
#
# NOTE: Hypothetically we should run these microbenchmarks on a machine running only a kernel and a shell,
# but this might be sometimes hard to achieve unless you have a spare computer to play with.
# When running microbenchmarks on your dev machine, make sure you have the bare minimum applications running on your laptop,
# otherwise you'll get a variance too high.
# Close Slack, the browser, the IDE, stop Docker, stop Netflix and grab a coffee while waiting for the results.
# Depending on the benchmark complexity/reproducibility, if the variance is too high, repeat the benchmarks.
function microbenchmarks_run_and_compare() {
if [ "$1" == "" ] || [ $# -gt 1 ]; then
echo "Error: Expecting an argument" >&2
echo "usage: $(basename $0) revision_to_compare" >&2
exit 1
fi
if [ "$2" == "" ]; then
OUTPUT_DIR=${ARTIFACTS:-$(mktemp -d)}
else
OUTPUT_DIR="$2"
fi
mkdir -p "$OUTPUT_DIR"
# Benchstat is required to compare the bench results
GO111MODULE=off go get golang.org/x/perf/cmd/benchstat
# Revision to use to compare with actual
REVISION="$1"
echo "--- Outputs will be at $OUTPUT_DIR"
# Run this revision benchmarks
microbenchmarks_run "$OUTPUT_DIR/new.txt"
echo "--- This revision results:"
cat "$OUTPUT_DIR/new.txt"
# Run other revision benchmarks
git checkout "$REVISION"
microbenchmarks_run "$OUTPUT_DIR/old.txt"
echo "--- $REVISION results:"
cat "$OUTPUT_DIR/old.txt"
# Print results in console
echo "--- Benchstat:"
benchstat "$OUTPUT_DIR/old.txt" "$OUTPUT_DIR/new.txt"
# Generate html results
benchstat -html "$OUTPUT_DIR/old.txt" "$OUTPUT_DIR/new.txt" >> "$OUTPUT_DIR/results.html"
}

4
vendor/modules.txt vendored
View File

@ -739,10 +739,10 @@ k8s.io/kube-openapi/pkg/util/sets
k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/trace
# knative.dev/hack v0.0.0-20201120192952-353db687ec5b
# knative.dev/hack v0.0.0-20201201234937-fddbf732e450
## explicit
knative.dev/hack
# knative.dev/pkg v0.0.0-20201125095035-9bf616d2f46a
# knative.dev/pkg v0.0.0-20201130192436-e5346d90e980
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck