Skip to content

Commit

Permalink
upgrade to latest dependencies (#448)
Browse files Browse the repository at this point in the history
Signed-off-by: Knative Automation <automation@knative.team>
  • Loading branch information
knative-automation authored Dec 3, 2020
1 parent d6b520e commit a5cc6ee
Show file tree
Hide file tree
Showing 7 changed files with 136 additions and 44 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ require (
k8s.io/apiserver v0.18.12
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451
knative.dev/eventing v0.19.1-0.20201130190736-241af67e1844
knative.dev/hack v0.0.0-20201125230335-c46a6498e9ed
knative.dev/pkg v0.0.0-20201130192436-e5346d90e980
knative.dev/eventing v0.19.1-0.20201202221809-1d3519c16565
knative.dev/hack v0.0.0-20201201234937-fddbf732e450
knative.dev/pkg v0.0.0-20201203005309-e45bbefd1d63
)

replace (
Expand Down
11 changes: 6 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1191,21 +1191,22 @@ k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C
k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451 h1:v8ud2Up6QK1lNOKFgiIVrZdMg7MpmSnvtrOieolJKoE=
k8s.io/utils v0.0.0-20200603063816-c1c6865ac451/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/eventing v0.19.1-0.20201130190736-241af67e1844 h1:IghjQeIkwSa6skZdUASyYM9b7tyyTttEA5r9mbdLxAE=
knative.dev/eventing v0.19.1-0.20201130190736-241af67e1844/go.mod h1:SD32TaZ0N3jbq5XxsuB8+uBuPUSI3eqaPswStSnjoxE=
knative.dev/eventing v0.19.1-0.20201202221809-1d3519c16565 h1:Xj/WF2mG4tyJvGEsuh6V311J/nwP3wPRJ1ioMO/Urs0=
knative.dev/eventing v0.19.1-0.20201202221809-1d3519c16565/go.mod h1:LeCXV+DSK6WMrgTJVE/Vyrpj5mo1BzbnpucjQh8zYf4=
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8 h1:RNbZsAjhswBPtl4C5C5gEFX5/GfWIOZQxfYD9DhkHdY=
knative.dev/hack v0.0.0-20201112185459-01a34c573bd8/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/hack v0.0.0-20201118155651-b31d3bb6bff9 h1:OgYL1cATsWTS6kztSOuQqhmYfcn6ZdpPAQQ6TKCx00I=
knative.dev/hack v0.0.0-20201118155651-b31d3bb6bff9/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
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/hack v0.0.0-20201125230335-c46a6498e9ed h1:DrTU+vxQrNJtySxyNovUtl4si0ozjtU/AYhYaTz34YA=
knative.dev/hack v0.0.0-20201125230335-c46a6498e9ed/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
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-20201117221452-0fccc54273ed h1:4LNEFhvD2Ya4WgCD3SC1WGXz81bjEvQgbcpe5XACI3I=
knative.dev/pkg v0.0.0-20201117221452-0fccc54273ed/go.mod h1:nxlh3CUvx6WBPr1WKD96AHxFZPD2UKRDo9RUp8ILTyQ=
knative.dev/pkg v0.0.0-20201127013335-0d896b5c87b8/go.mod h1:wXZqP8MXCxb51yNFlecA13BwG7Hk370SWDFWV4dx4ug=
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=
knative.dev/pkg v0.0.0-20201203005309-e45bbefd1d63 h1:ybRM/HKsR1x2idi7BI9rIOb4AAd5ZRCZSudPGQhw2io=
knative.dev/pkg v0.0.0-20201203005309-e45bbefd1d63/go.mod h1:efRLl6Z597X5r3TTt/I73cQIDDV1He6LMN1y4HQlkHU=
knative.dev/reconciler-test v0.0.0-20201124190335-83a44efcdfef/go.mod h1:YSs1y1rgnjs8w39/drLIOQbWvZUQwqApvd+EizO8UsA=
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=
Expand Down
34 changes: 34 additions & 0 deletions vendor/knative.dev/hack/codegen-library.sh
Original file line number Diff line number Diff line change
@@ -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
60 changes: 55 additions & 5 deletions vendor/knative.dev/hack/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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)
Expand All @@ -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" \
Expand All @@ -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() {
Expand Down
40 changes: 35 additions & 5 deletions vendor/knative.dev/hack/microbenchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,74 @@
# 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

echo "Output will be at $OUTPUT_FILE"

# Run all microbenchmarks
go clean
go test -bench=. -benchmem -run="^$" -v ./... >> "$OUTPUT_FILE" || exit
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"
OUTPUT_DIR=${ARTIFACTS:-$(mktemp -d)}

echo "Outputs will be at $OUTPUT_DIR"
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
Expand Down
23 changes: 0 additions & 23 deletions vendor/knative.dev/pkg/network/handlers/error.go

This file was deleted.

6 changes: 3 additions & 3 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ k8s.io/utils/buffer
k8s.io/utils/integer
k8s.io/utils/pointer
k8s.io/utils/trace
# knative.dev/eventing v0.19.1-0.20201130190736-241af67e1844
# knative.dev/eventing v0.19.1-0.20201202221809-1d3519c16565
## explicit
knative.dev/eventing/pkg/apis/config
knative.dev/eventing/pkg/apis/configs
Expand Down Expand Up @@ -1178,10 +1178,10 @@ knative.dev/eventing/test/test_images/performance
knative.dev/eventing/test/test_images/print
knative.dev/eventing/test/test_images/recordevents
knative.dev/eventing/test/test_images/request-sender
# knative.dev/hack v0.0.0-20201125230335-c46a6498e9ed
# knative.dev/hack v0.0.0-20201201234937-fddbf732e450
## explicit
knative.dev/hack
# knative.dev/pkg v0.0.0-20201130192436-e5346d90e980
# knative.dev/pkg v0.0.0-20201203005309-e45bbefd1d63
## explicit
knative.dev/pkg/apis
knative.dev/pkg/apis/duck
Expand Down

0 comments on commit a5cc6ee

Please sign in to comment.