From 2363136f2cf46909b1cebbd3c747a04b2c2477f1 Mon Sep 17 00:00:00 2001 From: Christoph Blecker Date: Sun, 7 Apr 2019 12:11:18 -0700 Subject: [PATCH] Remove has_changes logic from vendor scripts --- hack/verify-vendor-licenses.sh | 11 +---------- hack/verify-vendor.sh | 27 +++++++-------------------- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/hack/verify-vendor-licenses.sh b/hack/verify-vendor-licenses.sh index 8aea7de80df..3f0ee540d1f 100755 --- a/hack/verify-vendor-licenses.sh +++ b/hack/verify-vendor-licenses.sh @@ -21,15 +21,6 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" -readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}} -if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \ - ! kube::util::has_changes "${branch}" 'Godeps/' && \ - ! kube::util::has_changes "${branch}" 'go.mod' && \ - ! kube::util::has_changes "${branch}" 'go.sum' && \ - ! kube::util::has_changes "${branch}" 'vendor/'; then - exit 0 -fi - # create a nice clean place to put our new licenses # must be in the user dir (e.g. KUBE_ROOT) in order for the docker volume mount # to work with docker-machine on macs @@ -40,7 +31,7 @@ function cleanup { #echo "Removing workspace: ${_tmpdir}" rm -rf "${_tmpdir}" } -trap cleanup EXIT +kube::util::trap_add cleanup EXIT cp -r "${KUBE_ROOT}/Godeps" "${_tmpdir}/Godeps" ln -s "${KUBE_ROOT}/LICENSE" "${_tmpdir}" diff --git a/hack/verify-vendor.sh b/hack/verify-vendor.sh index 5595c8b7aa6..676d706f852 100755 --- a/hack/verify-vendor.sh +++ b/hack/verify-vendor.sh @@ -21,29 +21,16 @@ set -o pipefail KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. source "${KUBE_ROOT}/hack/lib/init.sh" -readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}} -if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \ - ! kube::util::has_changes "${branch}" 'Godeps/' && \ - ! kube::util::has_changes "${branch}" 'go.mod' && \ - ! kube::util::has_changes "${branch}" 'go.sum' && \ - ! kube::util::has_changes "${branch}" 'vendor/' && \ - ! kube::util::has_changes "${branch}" 'staging/' && \ - ! kube::util::has_changes "${branch}" 'hack/lib/' && \ - ! kube::util::has_changes "${branch}" 'hack/.*vendor'; then - exit 0 -fi - -if [[ -z ${TMP_GOPATH:-} ]]; then - # Create a nice clean place to put our new vendor - _tmpdir="$(kube::realpath "$(mktemp -d -t verifyvendor.XXXXXX)")" -else - # reuse what we might have saved previously - _tmpdir="${TMP_GOPATH}" -fi +# create a nice clean place to put our new licenses +# must be in the user dir (e.g. KUBE_ROOT) in order for the docker volume mount +# to work with docker-machine on macs +mkdir -p "${KUBE_ROOT}/_tmp" +_tmpdir="$(mktemp -d "${KUBE_ROOT}/_tmp/kube-vendor.XXXXXX")" if [[ -z ${KEEP_TMP:-} ]]; then KEEP_TMP=false fi + function cleanup { # make go module dirs writeable chmod -R +w "${_tmpdir}" @@ -54,7 +41,7 @@ function cleanup { rm -rf "${_tmpdir}" fi } -trap cleanup EXIT +kube::util::trap_add cleanup EXIT # Copy the contents of the kube directory into the nice clean place (which is NOT shaped like a GOPATH) _kubetmp="${_tmpdir}"