mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
Make skipping logic more robust in hack/verify-godep*
Also add an environment variable, KUBE_VERIFY_GIT_BRANCH, used with this logic.
This commit is contained in:
parent
bf3cc9d126
commit
24b3223141
@ -21,9 +21,6 @@ set -o xtrace
|
||||
|
||||
export REPO_DIR=${REPO_DIR:-$(pwd)}
|
||||
|
||||
# Produce a JUnit-style XML test report for Jenkins.
|
||||
export KUBE_JUNIT_REPORT_DIR=${WORKSPACE}/_artifacts
|
||||
|
||||
# Run the kubekins container, mapping in docker (so we can launch containers),
|
||||
# the repo directory, and the artifacts output directory.
|
||||
#
|
||||
@ -40,8 +37,9 @@ docker run --rm=true \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-v "$(which docker)":/bin/docker \
|
||||
-v "${REPO_DIR}":/go/src/k8s.io/kubernetes \
|
||||
-v "${KUBE_JUNIT_REPORT_DIR}":/workspace/artifacts \
|
||||
-v "${WORKSPACE}/_artifacts":/workspace/artifacts \
|
||||
-v /etc/localtime:/etc/localtime:ro \
|
||||
--env REPO_DIR="${REPO_DIR}" \
|
||||
-e "KUBE_VERIFY_GIT_BRANCH=${KUBE_VERIFY_GIT_BRANCH:-}" \
|
||||
-e "REPO_DIR=${REPO_DIR}" \
|
||||
-i gcr.io/google_containers/kubekins-test:0.7 \
|
||||
bash -c "cd kubernetes && ./hack/jenkins/test-dockerized.sh"
|
||||
|
@ -9,6 +9,7 @@
|
||||
builders:
|
||||
- shell: 'bash <(curl -fsS --retry 3 "https://raw.githubusercontent.com/kubernetes/kubernetes/master/hack/jenkins/upload-started.sh")'
|
||||
- shell: |
|
||||
export KUBE_VERIFY_GIT_BRANCH='{branch}'
|
||||
timeout -k {kill-timeout}m {timeout}m ./hack/jenkins/gotest-dockerized.sh && rc=$? || rc=$?
|
||||
{report-rc}
|
||||
publishers:
|
||||
|
@ -20,9 +20,15 @@ set -o pipefail
|
||||
|
||||
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE}")/.." && pwd -P)"
|
||||
|
||||
branch="${1:-master}"
|
||||
readonly branch="origin/${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}"
|
||||
echo "Checking for Godeps changes against ${branch}"
|
||||
# make sure the branch is valid, otherwise the next check will pass erroneously.
|
||||
if ! git describe "${branch}" >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
# notice this uses ... to find the first shared ancestor
|
||||
if ! git diff origin/"${branch}"...HEAD | grep 'Godeps/' > /dev/null; then
|
||||
if ! git diff --name-only "${branch}...HEAD" | grep 'Godeps/' > /dev/null; then
|
||||
echo "No Godeps changes detected."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -39,9 +39,15 @@ preload-dep() {
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||
|
||||
branch="${1:-master}"
|
||||
readonly branch="origin/${1:-${KUBE_VERIFY_GIT_BRANCH:-master}}"
|
||||
echo "Checking for Godeps changes against ${branch}"
|
||||
# make sure the branch is valid, otherwise the next check will pass erroneously.
|
||||
if ! git describe "${branch}" >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
# notice this uses ... to find the first shared ancestor
|
||||
if ! git diff origin/"${branch}"...HEAD | grep 'Godeps/' > /dev/null; then
|
||||
if ! git diff --name-only "${branch}...HEAD" | grep 'Godeps/' > /dev/null; then
|
||||
echo "No Godeps changes detected."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user