Skip to content

Commit 8dcf06a

Browse files
upgrade to latest dependencies (#332)
bumping knative.dev/hack 664eac5...6c30196: > 6c30196 🧹 Rewrite unit tests in Golang (# 215) > f9dc722 Format go code (# 218) bumping knative.dev/client 794cdef...59948bb: > 59948bb upgrade to latest dependencies (# 1730) > 6376f9a Add --scale-activation flag to match new Serving option (# 1729) Signed-off-by: Knative Automation <[email protected]> Signed-off-by: Knative Automation <[email protected]>
1 parent d2dd0d4 commit 8dcf06a

File tree

7 files changed

+97
-43
lines changed

7 files changed

+97
-43
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ go 1.17
55
require (
66
github.com/spf13/cobra v1.3.0
77
gotest.tools/v3 v3.1.0
8-
knative.dev/client v0.34.1-0.20220825103419-794cdef8e4e0
9-
knative.dev/hack v0.0.0-20220902220419-664eac5c391e
8+
knative.dev/client v0.34.1-0.20220906114442-59948bb3723d
9+
knative.dev/hack v0.0.0-20220907111718-6c301965af4c
1010

1111
)
1212

go.sum

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2166,21 +2166,23 @@ k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
21662166
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
21672167
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
21682168
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
2169-
knative.dev/caching v0.0.0-20220818010648-9df7bb739739/go.mod h1:q5//FJ59aFRK42YiLSaxgBzH18DBhrtSc7UWapwXT9Q=
2170-
knative.dev/client v0.34.1-0.20220825103419-794cdef8e4e0 h1:nJ10CWWkLanUT6YsgbzNgQdcfBSeGn1ykbGeH/a5pmw=
2171-
knative.dev/client v0.34.1-0.20220825103419-794cdef8e4e0/go.mod h1:bb65E1Cy1rrEamPpGHK2dp18j+ZZ2B2vTqsCSZOAzas=
2172-
knative.dev/control-protocol v0.0.0-20220818153549-f18dbde7d9bd/go.mod h1:vO3Xc0k0h6fFVsVG9kNMUMcVKG7MAx7jMbZDvgSuzwI=
2173-
knative.dev/eventing v0.34.1/go.mod h1:6UnNnPrEUNAM9PfCpf7L8N7G/1vq+HQlpOjzndY6ryw=
2169+
knative.dev/caching v0.0.0-20220823145618-5018eaf56c4c/go.mod h1:l0X/DM1BbBtl7UEubicsQBye+ff78VxnrreJDU4flqo=
2170+
knative.dev/client v0.34.1-0.20220906114442-59948bb3723d h1:2VReV5z4UELaRYJDo/+QU7gYd4LVcOKMeZDC9hfi4sI=
2171+
knative.dev/client v0.34.1-0.20220906114442-59948bb3723d/go.mod h1:2Z3qxDjIiniQCGrpvTRbbn9nxB8D5pzVH36E3xql+ko=
2172+
knative.dev/control-protocol v0.0.0-20220901015322-a445e807f6a7/go.mod h1:kV+UoX4DjjwMlS37wHV1ZC7OL7r5IPAOhUvTHWi347M=
2173+
knative.dev/eventing v0.34.1-0.20220902060017-e1866d7660ee/go.mod h1:6UnNnPrEUNAM9PfCpf7L8N7G/1vq+HQlpOjzndY6ryw=
21742174
knative.dev/hack v0.0.0-20220815132133-e9a8475f4329/go.mod h1:t/azP8I/Cygaw+87O7rkAPrNRjCelmtfSzWzu/9TM7I=
21752175
knative.dev/hack v0.0.0-20220823140917-8d1e4ccf9dc3/go.mod h1:t/azP8I/Cygaw+87O7rkAPrNRjCelmtfSzWzu/9TM7I=
2176-
knative.dev/hack v0.0.0-20220902220419-664eac5c391e h1:9l6GKXiwXuiU8z7/AQIF6oBFISu8geBVQltjKshh+fk=
21772176
knative.dev/hack v0.0.0-20220902220419-664eac5c391e/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
2177+
knative.dev/hack v0.0.0-20220907111718-6c301965af4c h1:TTVBodIukkW7CUXSep9k/nc+nynXbjkBqXyYZxIS9Jw=
2178+
knative.dev/hack v0.0.0-20220907111718-6c301965af4c/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
21782179
knative.dev/hack/schema v0.0.0-20220823140917-8d1e4ccf9dc3/go.mod h1:ffjwmdcrH5vN3mPhO8RrF2KfNnbHeCE2C60A+2cv3U0=
2179-
knative.dev/networking v0.0.0-20220818010248-e51df7cdf571/go.mod h1:m3ataWRwmbHjOY9sCFvcDWRNLVITxVl0fH0RxdCa4jE=
2180-
knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15 h1:GNmzHVaUo3zoi/wtIN71LPQaWy6DdoYzmb+GIq2s4fw=
2180+
knative.dev/networking v0.0.0-20220831065816-215bac90b28b/go.mod h1:vMMT540KNAh6TWmpGEFnExTxJ/j9cee5qNV7Bs0kzUk=
21812181
knative.dev/pkg v0.0.0-20220818004048-4a03844c0b15/go.mod h1:YLjXbkQLlGHok+u0FLfMbBHFzY9WGu3GHhnrptoAy8I=
2182+
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700 h1:6xjS69vf5Pbwu+dWckqPALmm5pc3p0/XScPpRBhugRc=
2183+
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700/go.mod h1:WIQZyPTLzT+z0V3/gB91aWugIi3E1mkU9rjCrLfjOwY=
21822184
knative.dev/reconciler-test v0.0.0-20220818122349-177f8264c28c/go.mod h1:A437yxlDVDVKQv779WlB9Nj9lWAMoOKHQXFXls24Sps=
2183-
knative.dev/serving v0.34.1/go.mod h1:IyfedOBq3KzcD5dZONjbix2BfS0jOwDq5td8UE9CjCk=
2185+
knative.dev/serving v0.34.1-0.20220905171742-62685b3b4a5a/go.mod h1:F1+qPPtn78vmrDdOoOsapHEOCzVqRcmDcFFJolWVuE0=
21842186
mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
21852187
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
21862188
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=

vendor/knative.dev/hack/e2e-tests.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function setup_test_cluster() {
7676
# Setup KO_DOCKER_REPO if it is a GKE cluster. Incorporate an element of
7777
# randomness to ensure that each run properly publishes images. Don't
7878
# owerwrite KO_DOCKER_REPO if already set.
79-
[ -z "${KO_DOCKER_REPO}" ] && \
79+
[ -z "${KO_DOCKER_REPO:-}" ] && \
8080
[[ "${k8s_cluster}" =~ ^gke_.* ]] && \
8181
export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${REPO_NAME}-e2e-img/${RANDOM}
8282

@@ -120,12 +120,14 @@ function success() {
120120
}
121121

122122
# Exit test, dumping current state info.
123-
# Parameters: $1 - error message (optional).
123+
# Parameters: $* - error message (optional).
124124
function fail_test() {
125-
[[ -n $1 ]] && echo "ERROR: $1"
126-
dump_cluster_state
127-
dump_metrics
128-
exit 1
125+
local message="$*"
126+
if [[ -n ${message:-} ]]; then
127+
message='test failed'
128+
fi
129+
add_trap "dump_cluster_state;dump_metrics" EXIT
130+
abort "${message}"
129131
}
130132

131133
SKIP_TEARDOWNS=0

vendor/knative.dev/hack/infra-library.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ function create_test_cluster() {
9191
fi
9292

9393
case "$1" in
94-
gke) create_gke_test_cluster "$2" "$3" "$4" ;;
95-
kind) create_kind_test_cluster "$2" "$3" "$4" ;;
94+
gke) create_gke_test_cluster "$2" "$3" "${4:-}" ;;
95+
kind) create_kind_test_cluster "$2" "$3" "${4:-}" ;;
9696
*) echo "unsupported provider: $1"; exit 1 ;;
9797
esac
9898

@@ -126,11 +126,11 @@ function create_gke_test_cluster() {
126126
# 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
127127
# 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.
128128
local extra_gcloud_flags=""
129-
if [[ "$ENABLE_GKE_TELEMETRY" != "true" ]]; then
129+
if [[ "${ENABLE_GKE_TELEMETRY:-}" != "true" ]]; then
130130
extra_gcloud_flags="${extra_gcloud_flags} --logging=NONE --monitoring=NONE"
131131
fi
132132

133-
if [[ "$ENABLE_PREEMPTIBLE_NODES" == "true" ]]; then
133+
if [[ "${ENABLE_PREEMPTIBLE_NODES:-}" == "true" ]]; then
134134
extra_gcloud_flags="${extra_gcloud_flags} --preemptible"
135135
fi
136136
run_kntest kubetest2 gke "${_custom_flags[@]}" --test-command="${_test_command[*]}" --extra-gcloud-flags="${extra_gcloud_flags}"

vendor/knative.dev/hack/library.sh

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@ fi
4040
readonly IS_PROW
4141
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
4242
readonly REPO_ROOT_DIR
43-
readonly REPO_NAME="${REPO_NAME:-$(basename "${REPO_ROOT_DIR}")}"
43+
44+
# Resolves the repository name given a root directory.
45+
# Parameters: $1 - repository root directory.
46+
function __resolveRepoName() {
47+
local repoName
48+
repoName="$(basename "${1:-$(git rev-parse --show-toplevel)}")"
49+
repoName="${repoName#knative-sandbox-}" # Remove knative-sandbox- prefix if any
50+
repoName="${repoName#knative-}" # Remove knative- prefix if any
51+
echo "${repoName}"
52+
}
53+
default_repo_name="$(__resolveRepoName "${REPO_ROOT_DIR}")"
54+
readonly REPO_NAME="${REPO_NAME:-$default_repo_name}"
55+
unset default_repo_name
4456

4557
# Useful flags about the current OS
4658
IS_LINUX=0
@@ -65,10 +77,6 @@ if [[ -z "${ARTIFACTS:-}" ]]; then
6577
fi
6678
mkdir -p "$ARTIFACTS"
6779

68-
69-
# On a Prow job, redirect stderr to stdout so it's synchronously added to log
70-
(( IS_PROW )) && exec 2>&1
71-
7280
# Return the major version of a release.
7381
# For example, "v0.2.1" returns "0"
7482
# Parameters: $1 - release version label.
@@ -94,23 +102,63 @@ function patch_version() {
94102
echo "${tokens[2]}"
95103
}
96104

97-
# Print error message and exit 1
105+
# Calculates the hashcode for a given string.
106+
# Parameters: $* - string to be hashed.
107+
# See: https://stackoverflow.com/a/48863502/844449
108+
function hashCode() {
109+
local input="$1"
110+
local -i h=0
111+
for ((i = 0; i < ${#input}; i++)); do
112+
# val is ASCII val
113+
printf -v val "%d" "'${input:$i:1}"
114+
hval=$((31 * h + val))
115+
# hash scheme
116+
if ((hval > 2147483647)); then
117+
h=$(( (hval - 2147483648) % 2147483648 ))
118+
elif ((hval < -2147483648)); then
119+
h=$(( (hval + 2147483648) % 2147483648 ))
120+
else
121+
h=$(( hval ))
122+
fi
123+
done
124+
# final hashCode in decimal
125+
printf "%d" $h
126+
}
127+
128+
# Calculates the retcode for a given string. Makes sure the return code is
129+
# non-zero.
130+
# Parameters: $* - string to be hashed.
131+
function calcRetcode() {
132+
local rc=1
133+
local rcc
134+
rcc="$(hashCode "$*")"
135+
if [[ $rcc != 0 ]]; then
136+
rc=$(( rcc % 255 ))
137+
fi
138+
echo "$rc"
139+
}
140+
141+
# Print error message and call exit(n) where n calculated from the error message.
98142
# Parameters: $1..$n - error message to be displayed
143+
# Globals: abort_retcode will change the default retcode to be returned
99144
function abort() {
100-
echo "error: $*" >&2
101-
exit 1
145+
make_banner '*' "ERROR: $*" >&2
146+
readonly abort_retcode="${abort_retcode:-$(calcRetcode "$*")}"
147+
exit "$abort_retcode"
102148
}
103149

104150
# Display a box banner.
105151
# Parameters: $1 - character to use for the box.
106152
# $2 - banner message.
107153
function make_banner() {
108154
local msg="$1$1$1$1 $2 $1$1$1$1"
109-
local border="${msg//[-0-9A-Za-z _.,\/()\']/$1}"
155+
local border="${msg//[^$1]/$1}"
110156
echo -e "${border}\n${msg}\n${border}"
111157
# TODO(adrcunha): Remove once logs have timestamps on Prow
112158
# For details, see https://github.com/kubernetes/test-infra/issues/10100
113-
echo -e "$1$1$1$1 $(TZ='UTC' date)\n${border}"
159+
if (( IS_PROW )); then
160+
echo -e "$1$1$1$1 $(TZ='UTC' date --rfc-3339=ns)\n${border}"
161+
fi
114162
}
115163

116164
# Simple header for logging purposes.
@@ -126,7 +174,7 @@ function subheader() {
126174

127175
# Simple warning banner for logging purposes.
128176
function warning() {
129-
make_banner '!' "$*" >&2
177+
make_banner '!' "WARN: $*" >&2
130178
}
131179

132180
# Checks whether the given function exists.
@@ -448,14 +496,14 @@ function report_go_test() {
448496
logfile="${xml/junit_/go_test_}"
449497
logfile="${logfile/.xml/.jsonl}"
450498
echo "Running go test with args: ${go_test_args[*]}"
499+
local gotest_retcode=0
451500
go_run gotest.tools/[email protected] \
452501
--format "${GO_TEST_VERBOSITY:-testname}" \
453502
--junitfile "${xml}" \
454503
--junitfile-testsuite-name relative \
455504
--junitfile-testcase-classname relative \
456505
--jsonfile "${logfile}" \
457-
-- "${go_test_args[@]}"
458-
local gotest_retcode=$?
506+
-- "${go_test_args[@]}" || gotest_retcode=$?
459507
echo "Finished run, return code is ${gotest_retcode}"
460508

461509
echo "XML report written to ${xml}"
@@ -558,6 +606,9 @@ function go_run() {
558606
if [[ "$package" != *@* ]]; then
559607
abort 'Package for "go_run" needs to have @version'
560608
fi
609+
if [[ "$package" == *@latest ]] && [[ "$package" != knative.dev* ]]; then
610+
warning 'Using @latest version for external dependencies is unsafe. Use numbered version!'
611+
fi
561612
shift 1
562613
GORUN_PATH="${GORUN_PATH:-$(go env GOPATH)}"
563614
# Some CI environments may have non-writable GOPATH

vendor/knative.dev/hack/presubmit-tests.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,14 @@ function run_integration_tests() {
240240
# Default integration test runner that runs all `test/e2e-*tests.sh`.
241241
function default_integration_test_runner() {
242242
local failed=0
243-
find test/ ! -name "$(printf "*\n*")" -name "e2e-*tests.sh" -maxdepth 1 > tmp
244-
while IFS= read -r e2e_test
245-
do
243+
244+
while IFS= read -r e2e_test; do
246245
echo "Running integration test ${e2e_test}"
247246
if ! ${e2e_test}; then
248247
failed=1
249248
step_failed "${e2e_test}"
250249
fi
251-
done < tmp
250+
done < <(find test/ ! -name "$(printf "*\n*")" -name "e2e-*tests.sh" -maxdepth 1)
252251
return ${failed}
253252
}
254253

@@ -284,16 +283,16 @@ function main() {
284283
git version
285284
echo ">> ko version"
286285
[[ -f /ko_version ]] && cat /ko_version || echo "unknown"
287-
if [[ "${DOCKER_IN_DOCKER_ENABLED}" == "true" ]]; then
286+
if [[ "${DOCKER_IN_DOCKER_ENABLED:-}" == "true" ]]; then
288287
echo ">> docker version"
289288
docker version
290289
fi
291290
if type java > /dev/null; then
292291
echo ">> java version"
293292
java -version
294-
echo "JAVA_HOME: $JAVA_HOME"
293+
echo "JAVA_HOME: ${JAVA_HOME:-}"
295294
fi
296-
if type mvn > /dev/null; then
295+
if command -v mvn > /dev/null; then
297296
echo ">> maven version"
298297
mvn --version
299298
fi

vendor/modules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ gotest.tools/v3/internal/assert
2828
gotest.tools/v3/internal/difflib
2929
gotest.tools/v3/internal/format
3030
gotest.tools/v3/internal/source
31-
# knative.dev/client v0.34.1-0.20220825103419-794cdef8e4e0
31+
# knative.dev/client v0.34.1-0.20220906114442-59948bb3723d
3232
## explicit; go 1.18
3333
knative.dev/client/pkg/kn/plugin
34-
# knative.dev/hack v0.0.0-20220902220419-664eac5c391e
34+
# knative.dev/hack v0.0.0-20220907111718-6c301965af4c
3535
## explicit; go 1.18
3636
knative.dev/hack

0 commit comments

Comments
 (0)