mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 11:42:14 +00:00
Split hack/{verify,update}-* files so we don't always go build
Right now some of the hack/* tools use `go run` and build almost every time. There are some which expect you to have already run `go install`. And in all cases the pre-commit hook, which runs a full build wouldn't want to do either, since it just built! This creates a new hack/after-build/ directory and has the scripts which REQUIRE that the binary already be built. It doesn't test and complain. It just fails miserably. Users should not be in this directory. Users should just use hack/verify-* which will just do the build and then call the "after-build" version. The pre-commit hook or anything which KNOWS the binaries have been built can use the fast version.
This commit is contained in:
@@ -23,31 +23,8 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
kube::golang::setup_env
|
||||
|
||||
function generate_version() {
|
||||
local version=$1
|
||||
local TMPFILE="/tmp/conversion_generated.$(date +%s).go"
|
||||
"${KUBE_ROOT}/hack/build-go.sh" cmd/genconversion
|
||||
|
||||
echo "Generating for version ${version}"
|
||||
"${KUBE_ROOT}/hack/after-build/update-generated-conversions.sh" "$@"
|
||||
|
||||
sed 's/YEAR/2015/' hack/boilerplate/boilerplate.go.txt > $TMPFILE
|
||||
cat >> $TMPFILE <<EOF
|
||||
package ${version}
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE
|
||||
EOF
|
||||
|
||||
GOPATH=$(godep path):$GOPATH go run cmd/genconversion/conversion.go -v ${version} -f - >> $TMPFILE
|
||||
|
||||
cat >> $TMPFILE <<EOF
|
||||
// AUTO-GENERATED FUNCTIONS END HERE
|
||||
EOF
|
||||
|
||||
mv $TMPFILE pkg/api/${version}/conversion_generated.go
|
||||
}
|
||||
|
||||
VERSIONS="v1"
|
||||
for ver in $VERSIONS; do
|
||||
# Ensure that the version being processed is registered by setting
|
||||
# KUBE_API_VERSIONS.
|
||||
KUBE_API_VERSIONS="${ver}" generate_version "${ver}"
|
||||
done
|
||||
# ex: ts=2 sw=2 et filetype=sh
|
||||
|
Reference in New Issue
Block a user