diff --git a/hack/generate.sh b/hack/generate.sh new file mode 100755 index 00000000..89e7a0c6 --- /dev/null +++ b/hack/generate.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Copyright 2018 The Kubernetes 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. + +# 'go generate's kind, using tools from vendor (go-bindata) + +set -o errexit + +REPO_ROOT=$(git rev-parse --show-toplevel) + +# install go-bindata from vendor locally +OUTPUT_GOBIN="${REPO_ROOT}/_output/bin" +GOBIN="${OUTPUT_GOBIN}" go install ./vendor/github.com/jteeuwen/go-bindata/go-bindata + +# go generate (using go-bindata) +# NOTE: go will only take package paths, not absolute directories +cd "${REPO_ROOT}" +PATH="${OUTPUT_GOBIN}:${PATH}" go generate ./kind/... +# gofmt the generated file +find ./kind -name "*.go" | xargs gofmt -s -w diff --git a/pkg/build/sources/generate.go b/pkg/build/sources/generate.go new file mode 100644 index 00000000..152d9aed --- /dev/null +++ b/pkg/build/sources/generate.go @@ -0,0 +1,24 @@ +/* +Copyright 2018 The Kubernetes 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. +*/ + +// Package sources contains the baked in sources kind needs to build. +// Primarily this includes the node-image dockerfile, which should rarely +// change. +// These can be overridden with newer files at build-time, see ./../build +package sources + +// We pull in the sources with go-bindata +//go:generate go-bindata -nometadata -mode=0666 -pkg=$GOPACKAGE -o=images_node_sources.go -ignore=(\.*README\.md)|(\.*BUILD\.bazel) -prefix=./../../../ ./../../../images/node/...