Run verify generated files remake in a tmp directory

We already do this in hack/verify-generated-files.sh so we should do it
in verify-generated-files-remake.sh as well.

The idea is that any local changes made because of code generation
should not persist beyond the current run of the script.

Change-Id: I7af176773ae16c393dc2b46c006595243c9fa05b
pull/564/head
Davanum Srinivas 2019-02-04 20:13:59 -05:00
parent 9d6ebf6c78
commit 0f2c948df7
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
1 changed files with 15 additions and 0 deletions

View File

@ -21,6 +21,21 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::util::ensure_clean_working_dir
_tmpdir="$(kube::realpath $(mktemp -d -t verify-generated-files.XXXXXX))"
kube::util::trap_add "rm -rf ${_tmpdir}" EXIT
_tmp_gopath="${_tmpdir}/go"
_tmp_kuberoot="${_tmp_gopath}/src/k8s.io/kubernetes"
mkdir -p "${_tmp_kuberoot}/.."
cp -a "${KUBE_ROOT}" "${_tmp_kuberoot}/.."
cd "${_tmp_kuberoot}"
# clean out anything from the temp dir that's not checked in
git clean -ffxd
# $1 = filename pattern as in "zz_generated.$1.go"
function find_genfiles() {
find . \