mirror of https://github.com/knative/caching.git
upgrade to latest dependencies (#881)
bumping knative.dev/hack b979959...9c9eed6:
> 9c9eed6 💝 Vendorless codegen via shell scripting (# 386)
Signed-off-by: Knative Automation <automation@knative.team>
This commit is contained in:
parent
989f54c837
commit
d2f87fc5e4
2
go.mod
2
go.mod
|
@ -10,7 +10,7 @@ require (
|
|||
k8s.io/client-go v0.29.2
|
||||
k8s.io/code-generator v0.29.2
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
|
||||
knative.dev/hack v0.0.0-20240704013904-b9799599afcf
|
||||
knative.dev/hack v0.0.0-20240719133331-9c9eed6f6679
|
||||
knative.dev/pkg v0.0.0-20240716082220-4355f0c73608
|
||||
)
|
||||
|
||||
|
|
4
go.sum
4
go.sum
|
@ -661,8 +661,8 @@ k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/A
|
|||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
|
||||
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
knative.dev/hack v0.0.0-20240704013904-b9799599afcf h1:n92FmZRywgtHso7pFAku7CW0qvRAs1hXtMQqO0R6eiE=
|
||||
knative.dev/hack v0.0.0-20240704013904-b9799599afcf/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
|
||||
knative.dev/hack v0.0.0-20240719133331-9c9eed6f6679 h1:tvbANb4KIO91DT1FGR4yCLA5E0qAmIeQ3DAGOkZGg4k=
|
||||
knative.dev/hack v0.0.0-20240719133331-9c9eed6f6679/go.mod h1:R0ritgYtjLDO9527h5vb5X6gfvt5LCrJ55BNbVDsWiY=
|
||||
knative.dev/pkg v0.0.0-20240716082220-4355f0c73608 h1:BOiRzcnRS9Z5ruxlCiS/K1/Hb5bUN0X4W3xCegdcYQE=
|
||||
knative.dev/pkg v0.0.0-20240716082220-4355f0c73608/go.mod h1:M67lDZ4KbltYSon0Ox4/6qjlZNOIXW4Ldequ81yofbw=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
Copyright #{YEAR} 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.
|
||||
*/
|
|
@ -16,21 +16,156 @@
|
|||
|
||||
# Setup the env for doing Knative style codegen.
|
||||
|
||||
kn_hack_library=${kn_hack_library:-"$(dirname $0)/../vendor/knative.dev/hack/library.sh"}
|
||||
# Store Bash options
|
||||
oldstate="$(set +o)"
|
||||
|
||||
set -Eeuo pipefail
|
||||
|
||||
export repodir kn_hack_dir kn_hack_library \
|
||||
MODULE_NAME CODEGEN_TMP_GOPATH CODEGEN_ORIGINAL_GOPATH GOPATH GOBIN \
|
||||
CODEGEN_PKG KNATIVE_CODEGEN_PKG
|
||||
|
||||
kn_hack_dir="$(realpath "$(dirname "${BASH_SOURCE[0]:-$0}")")"
|
||||
kn_hack_library=${kn_hack_library:-"${kn_hack_dir}/library.sh"}
|
||||
|
||||
if [[ -f "$kn_hack_library" ]]; then
|
||||
source $kn_hack_library
|
||||
# shellcheck disable=SC1090
|
||||
source "$kn_hack_library"
|
||||
else
|
||||
echo "this file is intended to be imported from a golang project that vendors knative.dev/hack"
|
||||
exit
|
||||
echo "The \$kn_hack_library points to a non-existent file: $kn_hack_library" >&2
|
||||
exit 42
|
||||
fi
|
||||
|
||||
export MODULE_NAME=$(go_mod_module_name)
|
||||
export GOPATH=$(go_mod_gopath_hack)
|
||||
export GOBIN=${GOPATH}/bin # Set GOBIN explicitly as deepcopy-gen is installed by go install.
|
||||
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 "${REPO_ROOT_DIR}")}
|
||||
repodir="$(go_run knative.dev/toolbox/modscope@latest current --path)"
|
||||
|
||||
[ -x ${CODEGEN_PKG}/generate-groups.sh ] || chmod +x ${CODEGEN_PKG}/generate-groups.sh
|
||||
[ -x ${CODEGEN_PKG}/generate-internal-groups.sh ] || chmod +x ${CODEGEN_PKG}/generate-internal-groups.sh
|
||||
[ -x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh ] || chmod +x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh
|
||||
function go-resolve-pkg-dir() {
|
||||
local pkg="${1:?Pass the package name}"
|
||||
local pkgdir
|
||||
if [ -d "${repodir}/vendor" ]; then
|
||||
pkgdir="${repodir}/vendor/${pkg}"
|
||||
if [ -d "${pkgdir}" ]; then
|
||||
echo "${pkgdir}"
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
go mod download -x > /dev/stderr
|
||||
go list -m -f '{{.Dir}}' "${pkg}" 2>/dev/null
|
||||
return $?
|
||||
fi
|
||||
}
|
||||
|
||||
# Change dir to the original executing script's directory, not the current source!
|
||||
pushd "$(dirname "$(realpath "$0")")" > /dev/null
|
||||
|
||||
if ! CODEGEN_PKG="${CODEGEN_PKG:-"$(go-resolve-pkg-dir k8s.io/code-generator)"}"; then
|
||||
warning "Failed to determine the k8s.io/code-generator package"
|
||||
fi
|
||||
if ! KNATIVE_CODEGEN_PKG="${KNATIVE_CODEGEN_PKG:-"$(go-resolve-pkg-dir knative.dev/pkg)"}"; then
|
||||
warning "Failed to determine the knative.dev/pkg package"
|
||||
fi
|
||||
|
||||
popd > /dev/null
|
||||
|
||||
CODEGEN_ORIGINAL_GOPATH="$(go env GOPATH)"
|
||||
CODEGEN_TMP_GOPATH=$(go_mod_gopath_hack)
|
||||
GOPATH="${CODEGEN_TMP_GOPATH}"
|
||||
GOBIN="${GOPATH}/bin" # Set GOBIN explicitly as k8s-gen' are installed by go install.
|
||||
|
||||
if [[ -n "${CODEGEN_PKG}" ]] && ! [ -x "${CODEGEN_PKG}/generate-groups.sh" ]; then
|
||||
chmod +x "${CODEGEN_PKG}/generate-groups.sh"
|
||||
chmod +x "${CODEGEN_PKG}/generate-internal-groups.sh"
|
||||
fi
|
||||
if [[ -n "${KNATIVE_CODEGEN_PKG}" ]] && ! [ -x "${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh" ]; then
|
||||
chmod +x "${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh"
|
||||
fi
|
||||
|
||||
# Generate boilerplate file with the current year
|
||||
function boilerplate() {
|
||||
local go_header_file="${kn_hack_dir}/boilerplate.go.txt"
|
||||
local current_boilerplate_file="${TMPDIR}/boilerplate.go.txt"
|
||||
# Replace #{YEAR} with the current year
|
||||
sed "s/#{YEAR}/$(date +%Y)/" \
|
||||
< "${go_header_file}" \
|
||||
> "${current_boilerplate_file}"
|
||||
echo "${current_boilerplate_file}"
|
||||
}
|
||||
|
||||
# Generate K8s' groups codegen
|
||||
function generate-groups() {
|
||||
if [[ -z "${CODEGEN_PKG}" ]]; then
|
||||
abort "CODEGEN_PKG is not set"
|
||||
fi
|
||||
"${CODEGEN_PKG}"/generate-groups.sh \
|
||||
"$@" \
|
||||
--go-header-file "$(boilerplate)"
|
||||
}
|
||||
|
||||
# Generate K8s' internal groups codegen
|
||||
function generate-internal-groups() {
|
||||
if [[ -z "${CODEGEN_PKG}" ]]; then
|
||||
abort "CODEGEN_PKG is not set"
|
||||
fi
|
||||
"${CODEGEN_PKG}"/generate-internal-groups.sh \
|
||||
"$@" \
|
||||
--go-header-file "$(boilerplate)"
|
||||
}
|
||||
|
||||
# Generate Knative style codegen
|
||||
function generate-knative() {
|
||||
if [[ -z "${KNATIVE_CODEGEN_PKG}" ]]; then
|
||||
abort "KNATIVE_CODEGEN_PKG is not set"
|
||||
fi
|
||||
"${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh" \
|
||||
"$@" \
|
||||
--go-header-file "$(boilerplate)"
|
||||
}
|
||||
|
||||
# Cleanup after generating code
|
||||
function cleanup-codegen() {
|
||||
restore-changes-if-its-copyright-year-only
|
||||
restore-gopath
|
||||
}
|
||||
|
||||
# Restore changes if the file contains only the change in the copyright year
|
||||
function restore-changes-if-its-copyright-year-only() {
|
||||
local difflist
|
||||
log "Cleaning up generated code"
|
||||
difflist="$(mktemp)"
|
||||
git diff --exit-code --name-only > "$difflist"
|
||||
# list git changes and skip those which differ only in the boilerplate year
|
||||
while read -r file; do
|
||||
# check if the file contains just the change in the boilerplate year
|
||||
if [ "$(LANG=C git diff --exit-code --shortstat -- "$file")" = ' 1 file changed, 1 insertion(+), 1 deletion(-)' ] && \
|
||||
[[ "$(git diff --exit-code -U1 -- "$file" | grep -Ec '^[+-]\s*[*#]?\s*Copyright 2[0-9]{3}')" -eq 2 ]]; then
|
||||
# restore changes to that file
|
||||
git checkout -- "$file"
|
||||
fi
|
||||
done < "$difflist"
|
||||
rm -f "$difflist"
|
||||
}
|
||||
|
||||
# Restore the GOPATH and clean up the temporary directory
|
||||
function restore-gopath() {
|
||||
# Skip this if the directory is already checked out onto the GOPATH.
|
||||
if __is_checkout_onto_gopath; then
|
||||
return
|
||||
fi
|
||||
if [ -d "$CODEGEN_TMP_GOPATH" ]; then
|
||||
chmod -R u+w "${CODEGEN_TMP_GOPATH}"
|
||||
rm -rf "${CODEGEN_TMP_GOPATH}"
|
||||
unset CODEGEN_TMP_GOPATH
|
||||
fi
|
||||
unset GOPATH GOBIN
|
||||
# Restore the original GOPATH, if it was different from the default one.
|
||||
if [ "$CODEGEN_ORIGINAL_GOPATH" != "$(go env GOPATH)" ]; then
|
||||
export GOPATH="$CODEGEN_ORIGINAL_GOPATH"
|
||||
fi
|
||||
unset CODEGEN_ORIGINAL_GOPATH
|
||||
}
|
||||
|
||||
add_trap cleanup-codegen EXIT
|
||||
|
||||
# Restore Bash options
|
||||
eval "$oldstate"
|
||||
|
|
|
@ -20,5 +20,5 @@ import (
|
|||
"embed"
|
||||
)
|
||||
|
||||
//go:embed *.sh
|
||||
//go:embed *.sh *.go.txt
|
||||
var Scripts embed.FS
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
go 1.18
|
||||
go 1.21
|
||||
|
||||
use (
|
||||
.
|
||||
|
|
|
@ -1,61 +1,102 @@
|
|||
cloud.google.com/go v0.26.0 h1:e0WKqKTd5BnrG8aKH3J3h+QvEIQtSUcf2n5UZ5ZgLtQ=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46 h1:lsxEuwrXEAokXB9qhlbKWPpo3KMLZQ5WB5WLQRW1uq0=
|
||||
github.com/PuerkitoBio/purell v1.0.0 h1:0GoNN3taZV6QI81IXgCbxMyEaJDXMSIjArYBCYzVVvs=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2 h1:JCHLVE3B+kJde7bIEo5N4J+ZbLhp0J1Fs+ulyRws4gE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1 h1:glEXhBS5PSLLv4IXzLA5yPRVX4bilULVyxxbrfOtDAk=
|
||||
github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
|
||||
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
|
||||
github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E=
|
||||
github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I=
|
||||
github.com/alecthomas/kong v0.9.0 h1:G5diXxc85KvoV2f0ZRVuMsi45IrBgx9zDNGNj165aPA=
|
||||
github.com/alecthomas/kong v0.9.0/go.mod h1:Y47y5gKfHp1hDc7CH7OeXgLIpp+Q2m1Ni0L5s3bI8Os=
|
||||
github.com/alecthomas/mango-kong v0.1.0 h1:iFVfP1k1K4qpml3JUQmD5I8MCQYfIvsD9mRdrw7jJC4=
|
||||
github.com/alecthomas/mango-kong v0.1.0/go.mod h1:t+TYVdsONUolf/BwVcm+15eqcdAj15h4Qe9MMFAwwT4=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA=
|
||||
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
|
||||
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
|
||||
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
|
||||
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
|
||||
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
|
||||
github.com/catppuccin/go v0.2.0 h1:ktBeIrIP42b/8FGiScP9sgrWOss3lw0Z5SktRoithGA=
|
||||
github.com/catppuccin/go v0.2.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
|
||||
github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0=
|
||||
github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw=
|
||||
github.com/charmbracelet/bubbletea v0.26.3 h1:iXyGvI+FfOWqkB2V07m1DF3xxQijxjY2j8PqiXYqasg=
|
||||
github.com/charmbracelet/bubbletea v0.26.3/go.mod h1:bpZHfDHTYJC5g+FBK+ptJRCQotRC+Dhh3AoMxa/2+3Q=
|
||||
github.com/charmbracelet/glamour v0.7.0 h1:2BtKGZ4iVJCDfMF229EzbeR1QRKLWztO9dMtjmqZSng=
|
||||
github.com/charmbracelet/glamour v0.7.0/go.mod h1:jUMh5MeihljJPQbJ/wf4ldw2+yBP59+ctV36jASy7ps=
|
||||
github.com/charmbracelet/huh v0.4.2 h1:5wLkwrA58XDAfEZsJzNQlfJ+K8N9+wYwvR5FOM7jXFM=
|
||||
github.com/charmbracelet/huh v0.4.2/go.mod h1:g9OXBgtY3zRV4ahnVih9bZE+1yGYN+y2C9Q6L2P+WM0=
|
||||
github.com/charmbracelet/log v0.4.0 h1:G9bQAcx8rWA2T3pWvx7YtPTPwgqpk7D68BX21IRW8ZM=
|
||||
github.com/charmbracelet/log v0.4.0/go.mod h1:63bXt/djrizTec0l11H20t8FDSvA4CRZJ1KH22MdptM=
|
||||
github.com/charmbracelet/x/exp/strings v0.0.0-20240525152034-77596eb8760e h1:DhvN6ye3nHLhRtNHtlrQ0Zk+vmeN7YtEnyIRfcl7e0E=
|
||||
github.com/charmbracelet/x/exp/strings v0.0.0-20240525152034-77596eb8760e/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ=
|
||||
github.com/charmbracelet/x/input v0.1.1 h1:YDOJaTUKCqtGnq9PHzx3pkkl4pXDOANUHmhH3DqMtM4=
|
||||
github.com/charmbracelet/x/input v0.1.1/go.mod h1:jvdTVUnNWj/RD6hjC4FsoB0SeZCJ2ZBkiuFP9zXvZI0=
|
||||
github.com/charmbracelet/x/term v0.1.1 h1:3cosVAiPOig+EV4X9U+3LDgtwwAoEzJjNdwbXDjF6yI=
|
||||
github.com/charmbracelet/x/term v0.1.1/go.mod h1:wB1fHt5ECsu3mXYusyzcngVWWlu1KKUmmLhfgr/Flxw=
|
||||
github.com/charmbracelet/x/windows v0.1.2 h1:Iumiwq2G+BRmgoayww/qfcvof7W/3uLoelhxojXlRWg=
|
||||
github.com/charmbracelet/x/windows v0.1.2/go.mod h1:GLEO/l+lizvFDBPLIOk+49gdX49L9YWMB5t+DZd0jkQ=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
|
||||
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
|
||||
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96 h1:cenwrSVm+Z7QLSV/BsnenAOcDXdX4cMv4wP0B/5QbPg=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
|
||||
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153 h1:yUdfgN0XgIJw7foRItutHYUIhlcKzcSf5vDpdhQAKTc=
|
||||
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473 h1:4cmBvAEBNJaGARUEs3/suWRyfyBfhf7I60WBZq+bv2w=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0 h1:EQciDnbrYxy13PgWoY8AqoxGiPrpgBZ1R8UNe3ddc+A=
|
||||
github.com/evanphx/json-patch v4.9.0+incompatible h1:kLcOMZeuLAJvL2BPWLMIj5oaZQobrkAqrL+WFZwQses=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680 h1:ZktWZesgun21uEDrwW7iEV1zPCGQldM2atlJZ3TdvVM=
|
||||
github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1 h1:wSt/4CYxs70xbATrGXhokKF1i0tZjENLOo1ioIO13zk=
|
||||
github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9 h1:tF+augKRWlWx0J0B7ZyyKSiTyV6E1zZe+7b3qQlcEf8=
|
||||
github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501 h1:C1JKChikHGpXwT5UQDFaryIpDtyyGL/CR6C2kB7F1oc=
|
||||
github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87 h1:zP3nY8Tk2E6RTkqGYrarZXuzh+ffyLDljLxCy1iJw80=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 h1:5ZkaAPbicIKTF2I64qf5Fh8Aa83Q/dnOafMYV0OMwjA=
|
||||
github.com/golang/mock v1.1.1 h1:G5FRp8JnTd7RQH5kemVNlMeyXQAztQ3mOWV95KxsXH8=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/googleapis/gnostic v0.4.1 h1:DLJCy1n/vrD4HPjOvYcT8aYQXpPIzoRZONaYwyycI+I=
|
||||
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E=
|
||||
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
|
||||
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
|
||||
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
|
||||
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
|
||||
github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
|
||||
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8=
|
||||
github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0=
|
||||
github.com/kisielk/errcheck v1.5.0 h1:e8esj/e4R+SAOwFwN+n3zr0nYeCyeweozKfO23MvHzY=
|
||||
github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg=
|
||||
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
|
||||
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
|
||||
github.com/mailru/easyjson v0.0.0-20160728113105-d5b7844b561a h1:TpvdAwDAt1K4ANVOfcihouRdvP+MgAfDWwBuct4l6ZY=
|
||||
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
|
||||
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
|
||||
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
|
||||
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
|
||||
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
|
||||
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
|
||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
|
||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
|
||||
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
||||
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
||||
github.com/muesli/mango v0.2.0 h1:iNNc0c5VLQ6fsMgAqGQofByNUBH2Q2nEbD6TaI+5yyQ=
|
||||
github.com/muesli/mango v0.2.0/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4=
|
||||
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
|
||||
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
|
||||
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
|
||||
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
|
||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d h1:7PxY7LVfSZm7PEeBTyK1rj1gABdCO2mbri6GKO1cMDs=
|
||||
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
|
||||
github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw=
|
||||
github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA=
|
||||
github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=
|
||||
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4 h1:c2HOrn5iMezYjSlGPncknSEr/8x5LELb/ilJbXi9DEA=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be h1:vEDujvNQGv4jgYKudGeI/+DAX4Jffq6hpD55MmoEvKs=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
|
||||
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd h1:5CtCZbICpIOFdgO940moixOPjc0178IU44m4EjOO5IY=
|
||||
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
|
||||
google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg=
|
||||
google.golang.org/protobuf v1.24.0 h1:UhZDfRO8JRQru4/+LlLE0BRKGF8L+PICnvYZmx/fEGA=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc h1:/hemPrYIhOhy8zYrNj+069zDB68us2sMGsfkFJO0iZs=
|
||||
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac h1:sAvhNk5RRuc6FNYGqe7Ygz3PSo/2wGWbulskmzRX8Vs=
|
||||
k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6 h1:+WnxoVtG8TMiudHBSEtrVL1egv36TkkJm+bA8AxicmQ=
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
||||
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U=
|
||||
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
|
||||
github.com/yuin/goldmark-emoji v1.0.2 h1:c/RgTShNgHTtc6xdz2KKI74jJr6rWi7FPgnP9GAsO5s=
|
||||
github.com/yuin/goldmark-emoji v1.0.2/go.mod h1:RhP/RWpexdp+KHs7ghKnifRoIs/Bq4nDS7tRbCkOwKY=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d h1:N0hmiNbwsSNwHBAvR3QB5w25pUwH4tK0Y/RltD1j1h4=
|
||||
golang.org/x/exp v0.0.0-20240525044651-4c93da0ed11d/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc=
|
||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
|
|
|
@ -138,18 +138,72 @@ function calcRetcode() {
|
|||
echo "$rc"
|
||||
}
|
||||
|
||||
# Print error message.
|
||||
# Parameters: $* - error message to be displayed
|
||||
function error() {
|
||||
local first="$1"
|
||||
shift
|
||||
local args=("ERROR: $first" "$@")
|
||||
gum_banner \
|
||||
--color '#D00' \
|
||||
--padding '1 3' \
|
||||
--border double \
|
||||
"${args[@]}" > /dev/stderr
|
||||
}
|
||||
|
||||
# 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() {
|
||||
make_banner '*' "ERROR: $*" >&2
|
||||
error "$@"
|
||||
readonly abort_retcode="${abort_retcode:-$(calcRetcode "$*")}"
|
||||
exit "$abort_retcode"
|
||||
}
|
||||
|
||||
# Simple header for logging purposes.
|
||||
function header() {
|
||||
local upper
|
||||
upper="$(echo "$*" | tr '[:lower:]' '[:upper:]')"
|
||||
gum_banner \
|
||||
--border double \
|
||||
--color 44 \
|
||||
--padding '1 3' \
|
||||
"$upper"
|
||||
}
|
||||
|
||||
# Simple subheader for logging purposes.
|
||||
function subheader() {
|
||||
gum_banner \
|
||||
--color 45 \
|
||||
"$@"
|
||||
}
|
||||
|
||||
# Simple log step for logging purposes.
|
||||
function log.step() {
|
||||
echo "=== $*" | gum_style --foreground 44
|
||||
}
|
||||
|
||||
# Simple log for logging purposes.
|
||||
function log() {
|
||||
echo "--- $*" | gum_style --foreground 45
|
||||
}
|
||||
|
||||
# Simple warning banner for logging purposes.
|
||||
function warning() {
|
||||
local first="$1"
|
||||
shift
|
||||
local args=("WARN: $first" "$@")
|
||||
gum_banner \
|
||||
--color '#DD0' \
|
||||
--padding '1 3' \
|
||||
--border rounded \
|
||||
"${args[@]}" > /dev/stderr
|
||||
}
|
||||
|
||||
# Display a box banner.
|
||||
# Parameters: $1 - character to use for the box.
|
||||
# $2 - banner message.
|
||||
# Deprecated: Use `gum_banner` instead.
|
||||
function make_banner() {
|
||||
local msg="$1$1$1$1 $2 $1$1$1$1"
|
||||
local border="${msg//[^$1]/$1}"
|
||||
|
@ -161,25 +215,62 @@ function make_banner() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Simple header for logging purposes.
|
||||
function header() {
|
||||
local upper="$(echo $1 | tr a-z A-Z)"
|
||||
make_banner "=" "${upper}"
|
||||
# Display a fancy box banner.
|
||||
# Parameters:
|
||||
# [--border <type>] - a gum border type for the box, defaults to 'rounded'
|
||||
# [--color <color>] - a gum color for the box, defaults to '0''
|
||||
# [--padding <padding>] - a gum padding for the box, defaults to '0 1'
|
||||
# $* - banner message.
|
||||
function gum_banner() {
|
||||
local border='rounded'
|
||||
local color='0'
|
||||
local padding='0 1'
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--border)
|
||||
border="$2"
|
||||
shift 2
|
||||
;;
|
||||
--color)
|
||||
color="$2"
|
||||
shift 2
|
||||
;;
|
||||
--padding)
|
||||
padding="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
local args=(
|
||||
--align center
|
||||
--border "$border"
|
||||
--foreground "$color"
|
||||
--border-foreground "$color"
|
||||
--padding "$padding"
|
||||
"$@"
|
||||
)
|
||||
# TODO: Remove once logs have timestamps on Prow, details see:
|
||||
# https://github.com/kubernetes/test-infra/issues/10100
|
||||
if (( IS_PROW )); then
|
||||
local dt
|
||||
# RFC3339Nano format with 3 digits of ns without timezone offset
|
||||
dt="$(TZ='UTC' date --rfc-3339=ns | sed -E 's/\.([0-9]{3})[0-9]+.+$/.\1/')"
|
||||
args+=('' "at $dt")
|
||||
fi
|
||||
gum_style "${args[@]}"
|
||||
}
|
||||
|
||||
# Simple subheader for logging purposes.
|
||||
function subheader() {
|
||||
make_banner "-" "$1"
|
||||
}
|
||||
|
||||
# Simple warning banner for logging purposes.
|
||||
function warning() {
|
||||
make_banner '!' "WARN: $*" >&2
|
||||
# Simple info banner for logging purposes.
|
||||
function gum_style() {
|
||||
go_run github.com/charmbracelet/gum@v0.14.1 style "$@"
|
||||
}
|
||||
|
||||
# Checks whether the given function exists.
|
||||
function function_exists() {
|
||||
[[ "$(type -t $1)" == "function" ]]
|
||||
[[ "$(type -t "$1")" == "function" ]]
|
||||
}
|
||||
|
||||
# GitHub Actions aware output grouping.
|
||||
|
@ -187,7 +278,7 @@ 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
|
||||
add_trap end_group EXIT
|
||||
else
|
||||
end_group
|
||||
fi
|
||||
|
@ -198,10 +289,10 @@ function group() {
|
|||
# GitHub Actions aware output grouping.
|
||||
function start_group() {
|
||||
if [[ -n ${GITHUB_WORKFLOW:-} ]]; then
|
||||
echo "::group::$@"
|
||||
trap end_group EXIT
|
||||
echo "::group::$*"
|
||||
add_trap end_group EXIT
|
||||
else
|
||||
echo "--- $@"
|
||||
log "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -517,7 +608,7 @@ function report_go_test() {
|
|||
echo "Test log (ANSI) written to ${ansilog}"
|
||||
|
||||
htmllog="${logfile/.jsonl/.html}"
|
||||
go_run github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@v3.11.0 \
|
||||
go_run github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@v3.10.0 \
|
||||
--preview < "$ansilog" > "$htmllog"
|
||||
echo "Test log (HTML) written to ${htmllog}"
|
||||
|
||||
|
@ -682,18 +773,18 @@ function go_update_deps() {
|
|||
|
||||
function __clean_goworksum_if_exists() {
|
||||
if [ -f "$REPO_ROOT_DIR/go.work.sum" ]; then
|
||||
echo "=== Cleaning the go.work.sum file"
|
||||
true > "$REPO_ROOT_DIR/go.work.sum"
|
||||
log.step 'Cleaning the go.work.sum file'
|
||||
truncate --size 0 "$REPO_ROOT_DIR/go.work.sum"
|
||||
fi
|
||||
}
|
||||
|
||||
function __remove_goworksum_if_empty() {
|
||||
if [ -f "$REPO_ROOT_DIR/go.work" ]; then
|
||||
echo "=== Syncing the go workspace"
|
||||
log.step 'Syncing the go workspace'
|
||||
go work sync
|
||||
fi
|
||||
if ! [ -s "$REPO_ROOT_DIR/go.work.sum" ]; then
|
||||
echo "=== Removing empty go.work.sum"
|
||||
log.step 'Removing empty go.work.sum'
|
||||
rm -f "$REPO_ROOT_DIR/go.work.sum"
|
||||
fi
|
||||
}
|
||||
|
@ -706,7 +797,7 @@ function __go_update_deps_for_module() {
|
|||
export GONOSUMDB="${GONOSUMDB:-},knative.dev/*"
|
||||
export GONOPROXY="${GONOPROXY:-},knative.dev/*"
|
||||
|
||||
echo "=== Update Deps for Golang module: $(go_mod_module_name)"
|
||||
log.step "Update Deps for Golang module: $(go_mod_module_name)"
|
||||
|
||||
local UPGRADE=0
|
||||
local RELEASE="v9000.1" # release v9000 is so far in the future, it will always pick the default branch.
|
||||
|
@ -752,7 +843,12 @@ function __go_update_deps_for_module() {
|
|||
|
||||
if [[ "${FORCE_VENDOR:-false}" == "true" ]] || [ -d vendor ]; then
|
||||
group "Go mod vendor"
|
||||
go mod vendor 2>&1 | grep -v "ignoring symlink" || true
|
||||
# Call go work vendor for Go 1.22+ and go.work file exists.
|
||||
if [ -f "$REPO_ROOT_DIR/go.work" ] && go help work vendor &>/dev/null; then
|
||||
go work vendor
|
||||
else
|
||||
go mod vendor
|
||||
fi
|
||||
else
|
||||
go mod download -x
|
||||
fi
|
||||
|
@ -785,22 +881,32 @@ function go_mod_module_name() {
|
|||
go_run knative.dev/toolbox/modscope@latest current
|
||||
}
|
||||
|
||||
function __is_checkout_onto_gopath() {
|
||||
! [ "${REPO_ROOT_DIR##"$(go env GOPATH)"}" = "$REPO_ROOT_DIR" ]
|
||||
}
|
||||
|
||||
# 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() {
|
||||
# Skip this if the directory is already checked out onto the GOPATH.
|
||||
if [[ "${REPO_ROOT_DIR##$(go env GOPATH)}" != "$REPO_ROOT_DIR" ]]; then
|
||||
# Skip this if the directory is already checked out onto the GOPATH.
|
||||
if __is_checkout_onto_gopath; then
|
||||
go env GOPATH
|
||||
return
|
||||
fi
|
||||
|
||||
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}"
|
||||
local TMP_GOPATH TMP_REPO_PATH
|
||||
TMP_GOPATH="$TMPDIR/go"
|
||||
TMP_REPO_PATH="${TMP_GOPATH}/src/$(go_mod_module_name)"
|
||||
if [ -d "${TMP_REPO_PATH}" ]; then
|
||||
echo "${TMP_GOPATH}"
|
||||
return
|
||||
fi
|
||||
mkdir -p "$(dirname "${TMP_REPO_PATH}")"
|
||||
ln -s "${REPO_ROOT_DIR}" "${TMP_REPO_PATH}"
|
||||
|
||||
echo "${TMP_DIR}"
|
||||
echo "${TMP_GOPATH}"
|
||||
}
|
||||
|
||||
# Run kntest tool
|
||||
|
@ -1014,6 +1120,7 @@ function latest_version() {
|
|||
|
||||
# Initializations that depend on previous functions.
|
||||
# These MUST come last.
|
||||
MODULE_NAME="$(go_mod_module_name)"
|
||||
|
||||
readonly _TEST_INFRA_SCRIPTS_DIR="$(dirname $(get_canonical_path "${BASH_SOURCE[0]}"))"
|
||||
readonly REPO_NAME_FORMATTED="Knative $(capitalize "${REPO_NAME//-/ }")"
|
||||
|
|
|
@ -72,9 +72,11 @@ function initialize_environment() {
|
|||
# Parameters: $1 - test group name (e.g., build)
|
||||
# $2 - result (0=passed, 1=failed)
|
||||
function results_banner() {
|
||||
local result
|
||||
[[ $2 -eq 0 ]] && result="PASSED" || result="FAILED"
|
||||
header "$1 tests ${result}"
|
||||
if [[ $2 -eq 0 ]]; then
|
||||
header "$1 tests PASSED"
|
||||
else
|
||||
error "$1 tests FAILED"
|
||||
fi
|
||||
}
|
||||
|
||||
# Run build tests. If there's no `build_tests` function, run the default
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
# This is a helper script for Knative release scripts.
|
||||
# See README.md for instructions on how to use it.
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/library.sh
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/library.sh"
|
||||
|
||||
# Organization name in GitHub; defaults to Knative.
|
||||
readonly ORG_NAME="${ORG_NAME:-knative}"
|
||||
|
@ -37,9 +37,9 @@ readonly RELEASE_SIGNING_IDENTITY="signer@knative-releases.iam.gserviceaccount.c
|
|||
readonly GEO_REPLICATION=(us eu asia)
|
||||
|
||||
# Simple banner for logging purposes.
|
||||
# Parameters: $1 - message to display.
|
||||
# Parameters: $* - message to display.
|
||||
function banner() {
|
||||
make_banner "@" "$1"
|
||||
subheader "$*"
|
||||
}
|
||||
|
||||
# Tag images in the yaml files if $TAG is not empty.
|
||||
|
|
|
@ -684,8 +684,8 @@ k8s.io/utils/pointer
|
|||
k8s.io/utils/ptr
|
||||
k8s.io/utils/strings/slices
|
||||
k8s.io/utils/trace
|
||||
# knative.dev/hack v0.0.0-20240704013904-b9799599afcf
|
||||
## explicit; go 1.18
|
||||
# knative.dev/hack v0.0.0-20240719133331-9c9eed6f6679
|
||||
## explicit; go 1.21
|
||||
knative.dev/hack
|
||||
# knative.dev/pkg v0.0.0-20240716082220-4355f0c73608
|
||||
## explicit; go 1.22
|
||||
|
|
Loading…
Reference in New Issue