Remove has_changes logic from vendor scripts

k3s-v1.15.3
Christoph Blecker 2019-04-07 12:11:18 -07:00
parent 668a288595
commit 2363136f2c
No known key found for this signature in database
GPG Key ID: B34A59A9D39F838B
2 changed files with 8 additions and 30 deletions

View File

@ -21,15 +21,6 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/hack/lib/init.sh" 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 # 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 # must be in the user dir (e.g. KUBE_ROOT) in order for the docker volume mount
# to work with docker-machine on macs # to work with docker-machine on macs
@ -40,7 +31,7 @@ function cleanup {
#echo "Removing workspace: ${_tmpdir}" #echo "Removing workspace: ${_tmpdir}"
rm -rf "${_tmpdir}" rm -rf "${_tmpdir}"
} }
trap cleanup EXIT kube::util::trap_add cleanup EXIT
cp -r "${KUBE_ROOT}/Godeps" "${_tmpdir}/Godeps" cp -r "${KUBE_ROOT}/Godeps" "${_tmpdir}/Godeps"
ln -s "${KUBE_ROOT}/LICENSE" "${_tmpdir}" ln -s "${KUBE_ROOT}/LICENSE" "${_tmpdir}"

View File

@ -21,29 +21,16 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
source "${KUBE_ROOT}/hack/lib/init.sh" source "${KUBE_ROOT}/hack/lib/init.sh"
readonly branch=${1:-${KUBE_VERIFY_GIT_BRANCH:-master}} # create a nice clean place to put our new licenses
if ! [[ ${KUBE_FORCE_VERIFY_CHECKS:-} =~ ^[yY]$ ]] && \ # must be in the user dir (e.g. KUBE_ROOT) in order for the docker volume mount
! kube::util::has_changes "${branch}" 'Godeps/' && \ # to work with docker-machine on macs
! kube::util::has_changes "${branch}" 'go.mod' && \ mkdir -p "${KUBE_ROOT}/_tmp"
! kube::util::has_changes "${branch}" 'go.sum' && \ _tmpdir="$(mktemp -d "${KUBE_ROOT}/_tmp/kube-vendor.XXXXXX")"
! 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
if [[ -z ${KEEP_TMP:-} ]]; then if [[ -z ${KEEP_TMP:-} ]]; then
KEEP_TMP=false KEEP_TMP=false
fi fi
function cleanup { function cleanup {
# make go module dirs writeable # make go module dirs writeable
chmod -R +w "${_tmpdir}" chmod -R +w "${_tmpdir}"
@ -54,7 +41,7 @@ function cleanup {
rm -rf "${_tmpdir}" rm -rf "${_tmpdir}"
fi 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) # Copy the contents of the kube directory into the nice clean place (which is NOT shaped like a GOPATH)
_kubetmp="${_tmpdir}" _kubetmp="${_tmpdir}"