Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[main] Upgrade to latest dependencies #677

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ require (
k8s.io/client-go v0.23.9
k8s.io/code-generator v0.23.9
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65
knative.dev/hack v0.0.0-20220902220419-664eac5c391e
knative.dev/hack/schema v0.0.0-20220902220419-664eac5c391e
knative.dev/hack v0.0.0-20220907111718-6c301965af4c
knative.dev/hack/schema v0.0.0-20220907111718-6c301965af4c
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700
)

Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1049,10 +1049,10 @@ k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod h1:jPW/WVKK9YHAvNhRxK0md/
k8s.io/utils v0.0.0-20211116205334-6203023598ed/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
knative.dev/hack v0.0.0-20220902220419-664eac5c391e h1:9l6GKXiwXuiU8z7/AQIF6oBFISu8geBVQltjKshh+fk=
knative.dev/hack v0.0.0-20220902220419-664eac5c391e/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/hack/schema v0.0.0-20220902220419-664eac5c391e h1:wSWIKkeB2YPfecyMM0oykecs4YTjpeY8+ef2lvCYlR8=
knative.dev/hack/schema v0.0.0-20220902220419-664eac5c391e/go.mod h1:GeIb+PLd5mllawcpHEGF5J5fYTQrvgEO5liao8lUKUs=
knative.dev/hack v0.0.0-20220907111718-6c301965af4c h1:TTVBodIukkW7CUXSep9k/nc+nynXbjkBqXyYZxIS9Jw=
knative.dev/hack v0.0.0-20220907111718-6c301965af4c/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
knative.dev/hack/schema v0.0.0-20220907111718-6c301965af4c h1:wgMbF4xbFU6JH5R/+JlcVgpnWGbX6TGCY9QdxQQisb4=
knative.dev/hack/schema v0.0.0-20220907111718-6c301965af4c/go.mod h1:GeIb+PLd5mllawcpHEGF5J5fYTQrvgEO5liao8lUKUs=
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700 h1:6xjS69vf5Pbwu+dWckqPALmm5pc3p0/XScPpRBhugRc=
knative.dev/pkg v0.0.0-20220826162920-93b66e6a8700/go.mod h1:WIQZyPTLzT+z0V3/gB91aWugIi3E1mkU9rjCrLfjOwY=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
Expand Down
14 changes: 8 additions & 6 deletions vendor/knative.dev/hack/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function setup_test_cluster() {
# Setup KO_DOCKER_REPO if it is a GKE cluster. Incorporate an element of
# randomness to ensure that each run properly publishes images. Don't
# owerwrite KO_DOCKER_REPO if already set.
[ -z "${KO_DOCKER_REPO}" ] && \
[ -z "${KO_DOCKER_REPO:-}" ] && \
[[ "${k8s_cluster}" =~ ^gke_.* ]] && \
export KO_DOCKER_REPO=gcr.io/${E2E_PROJECT_ID}/${REPO_NAME}-e2e-img/${RANDOM}

Expand Down Expand Up @@ -120,12 +120,14 @@ function success() {
}

# Exit test, dumping current state info.
# Parameters: $1 - error message (optional).
# Parameters: $* - error message (optional).
function fail_test() {
[[ -n $1 ]] && echo "ERROR: $1"
dump_cluster_state
dump_metrics
exit 1
local message="$*"
if [[ -n ${message:-} ]]; then
message='test failed'
fi
add_trap "dump_cluster_state;dump_metrics" EXIT
abort "${message}"
}

SKIP_TEARDOWNS=0
Expand Down
8 changes: 4 additions & 4 deletions vendor/knative.dev/hack/infra-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ function create_test_cluster() {
fi

case "$1" in
gke) create_gke_test_cluster "$2" "$3" "$4" ;;
kind) create_kind_test_cluster "$2" "$3" "$4" ;;
gke) create_gke_test_cluster "$2" "$3" "${4:-}" ;;
kind) create_kind_test_cluster "$2" "$3" "${4:-}" ;;
*) echo "unsupported provider: $1"; exit 1 ;;
esac

Expand Down Expand Up @@ -126,11 +126,11 @@ function create_gke_test_cluster() {
# 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
# 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.
local extra_gcloud_flags=""
if [[ "$ENABLE_GKE_TELEMETRY" != "true" ]]; then
if [[ "${ENABLE_GKE_TELEMETRY:-}" != "true" ]]; then
extra_gcloud_flags="${extra_gcloud_flags} --logging=NONE --monitoring=NONE"
fi

if [[ "$ENABLE_PREEMPTIBLE_NODES" == "true" ]]; then
if [[ "${ENABLE_PREEMPTIBLE_NODES:-}" == "true" ]]; then
extra_gcloud_flags="${extra_gcloud_flags} --preemptible"
fi
run_kntest kubetest2 gke "${_custom_flags[@]}" --test-command="${_test_command[*]}" --extra-gcloud-flags="${extra_gcloud_flags}"
Expand Down
77 changes: 64 additions & 13 deletions vendor/knative.dev/hack/library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,19 @@ fi
readonly IS_PROW
[[ ! -v REPO_ROOT_DIR ]] && REPO_ROOT_DIR="$(git rev-parse --show-toplevel)"
readonly REPO_ROOT_DIR
readonly REPO_NAME="${REPO_NAME:-$(basename "${REPO_ROOT_DIR}")}"

# Resolves the repository name given a root directory.
# Parameters: $1 - repository root directory.
function __resolveRepoName() {
local repoName
repoName="$(basename "${1:-$(git rev-parse --show-toplevel)}")"
repoName="${repoName#knative-sandbox-}" # Remove knative-sandbox- prefix if any
repoName="${repoName#knative-}" # Remove knative- prefix if any
echo "${repoName}"
}
default_repo_name="$(__resolveRepoName "${REPO_ROOT_DIR}")"
readonly REPO_NAME="${REPO_NAME:-$default_repo_name}"
unset default_repo_name

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


# On a Prow job, redirect stderr to stdout so it's synchronously added to log
(( IS_PROW )) && exec 2>&1

# Return the major version of a release.
# For example, "v0.2.1" returns "0"
# Parameters: $1 - release version label.
Expand All @@ -94,23 +102,63 @@ function patch_version() {
echo "${tokens[2]}"
}

# Print error message and exit 1
# Calculates the hashcode for a given string.
# Parameters: $* - string to be hashed.
# See: https://stackoverflow.com/a/48863502/844449
function hashCode() {
local input="$1"
local -i h=0
for ((i = 0; i < ${#input}; i++)); do
# val is ASCII val
printf -v val "%d" "'${input:$i:1}"
hval=$((31 * h + val))
# hash scheme
if ((hval > 2147483647)); then
h=$(( (hval - 2147483648) % 2147483648 ))
elif ((hval < -2147483648)); then
h=$(( (hval + 2147483648) % 2147483648 ))
else
h=$(( hval ))
fi
done
# final hashCode in decimal
printf "%d" $h
}

# Calculates the retcode for a given string. Makes sure the return code is
# non-zero.
# Parameters: $* - string to be hashed.
function calcRetcode() {
local rc=1
local rcc
rcc="$(hashCode "$*")"
if [[ $rcc != 0 ]]; then
rc=$(( rcc % 255 ))
fi
echo "$rc"
}

# Print error message and call exit(n) where n calculated from the error message.
# Parameters: $1..$n - error message to be displayed
# Globals: abort_retcode will change the default retcode to be returned
function abort() {
echo "error: $*" >&2
exit 1
make_banner '*' "ERROR: $*" >&2
readonly abort_retcode="${abort_retcode:-$(calcRetcode "$*")}"
exit "$abort_retcode"
}

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

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

# Simple warning banner for logging purposes.
function warning() {
make_banner '!' "$*" >&2
make_banner '!' "WARN: $*" >&2
}

# Checks whether the given function exists.
Expand Down Expand Up @@ -448,14 +496,14 @@ function report_go_test() {
logfile="${xml/junit_/go_test_}"
logfile="${logfile/.xml/.jsonl}"
echo "Running go test with args: ${go_test_args[*]}"
local gotest_retcode=0
go_run gotest.tools/gotestsum@v1.8.0 \
--format "${GO_TEST_VERBOSITY:-testname}" \
--junitfile "${xml}" \
--junitfile-testsuite-name relative \
--junitfile-testcase-classname relative \
--jsonfile "${logfile}" \
-- "${go_test_args[@]}"
local gotest_retcode=$?
-- "${go_test_args[@]}" || gotest_retcode=$?
echo "Finished run, return code is ${gotest_retcode}"

echo "XML report written to ${xml}"
Expand Down Expand Up @@ -558,6 +606,9 @@ function go_run() {
if [[ "$package" != *@* ]]; then
abort 'Package for "go_run" needs to have @version'
fi
if [[ "$package" == *@latest ]] && [[ "$package" != knative.dev* ]]; then
warning 'Using @latest version for external dependencies is unsafe. Use numbered version!'
fi
shift 1
GORUN_PATH="${GORUN_PATH:-$(go env GOPATH)}"
# Some CI environments may have non-writable GOPATH
Expand Down
13 changes: 6 additions & 7 deletions vendor/knative.dev/hack/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,14 @@ function run_integration_tests() {
# Default integration test runner that runs all `test/e2e-*tests.sh`.
function default_integration_test_runner() {
local failed=0
find test/ ! -name "$(printf "*\n*")" -name "e2e-*tests.sh" -maxdepth 1 > tmp
while IFS= read -r e2e_test
do

while IFS= read -r e2e_test; do
echo "Running integration test ${e2e_test}"
if ! ${e2e_test}; then
failed=1
step_failed "${e2e_test}"
fi
done < tmp
done < <(find test/ ! -name "$(printf "*\n*")" -name "e2e-*tests.sh" -maxdepth 1)
return ${failed}
}

Expand Down Expand Up @@ -284,16 +283,16 @@ function main() {
git version
echo ">> ko version"
[[ -f /ko_version ]] && cat /ko_version || echo "unknown"
if [[ "${DOCKER_IN_DOCKER_ENABLED}" == "true" ]]; then
if [[ "${DOCKER_IN_DOCKER_ENABLED:-}" == "true" ]]; then
echo ">> docker version"
docker version
fi
if type java > /dev/null; then
echo ">> java version"
java -version
echo "JAVA_HOME: $JAVA_HOME"
echo "JAVA_HOME: ${JAVA_HOME:-}"
fi
if type mvn > /dev/null; then
if command -v mvn > /dev/null; then
echo ">> maven version"
mvn --version
fi
Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -799,10 +799,10 @@ k8s.io/utils/internal/third_party/forked/golang/net
k8s.io/utils/net
k8s.io/utils/pointer
k8s.io/utils/trace
# knative.dev/hack v0.0.0-20220902220419-664eac5c391e
# knative.dev/hack v0.0.0-20220907111718-6c301965af4c
## explicit; go 1.18
knative.dev/hack
# knative.dev/hack/schema v0.0.0-20220902220419-664eac5c391e
# knative.dev/hack/schema v0.0.0-20220907111718-6c301965af4c
## explicit; go 1.18
knative.dev/hack/schema/commands
knative.dev/hack/schema/docs
Expand Down