From 5cda592b2c8ba9bb2f9900c4dbda6fb763fb2068 Mon Sep 17 00:00:00 2001 From: Jacob Beacham Date: Thu, 13 Apr 2017 13:54:10 -0700 Subject: [PATCH] Use a consistent build id between bazel/kubeadm pull jobs. Since the kubeadm e2e job uses the CI artifacts pushed by the bazel job, make sure we use a consistent id for their storage (the Kubernetes version isn't stable for pull jobs since each job pulls and applies the PR at different times, resulting in different commit SHAs). --- jobs/pull-kubernetes-bazel.sh | 6 +++--- jobs/pull-kubernetes-e2e-kubeadm-gce.sh | 13 ++++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/jobs/pull-kubernetes-bazel.sh b/jobs/pull-kubernetes-bazel.sh index 137a7ae3b195..8baf8c95703e 100755 --- a/jobs/pull-kubernetes-bazel.sh +++ b/jobs/pull-kubernetes-bazel.sh @@ -34,11 +34,11 @@ if [[ "${rc}" == 0 ]]; then fi if [[ "${rc}" == 0 ]]; then - version=$(cat bazel-genfiles/version || true) - if [[ -z "${version}" ]]; then - echo "Kubernetes version missing; not uploading ci artifacts." + if [[ -z "${PULL_NUMBER:-}" || -z "${PULL_REFS:-}" ]]; then + echo "\$PULL_NUMBER or \$PULL_REFS is empty; not uploading ci artifacts." rc=1 else + version=${PULL_NUMBER:-}/${PULL_REFS:-} bazel run //:ci-artifacts -- "gs://kubernetes-release-dev/bazel/${version}" && rc=$? || rc=$? fi fi diff --git a/jobs/pull-kubernetes-e2e-kubeadm-gce.sh b/jobs/pull-kubernetes-e2e-kubeadm-gce.sh index d8144308d638..ce13ad66e3d8 100755 --- a/jobs/pull-kubernetes-e2e-kubeadm-gce.sh +++ b/jobs/pull-kubernetes-e2e-kubeadm-gce.sh @@ -26,18 +26,17 @@ readonly testinfra="$(dirname "${0}")/.." export PROJECT="k8s-jkns-pr-kubeadm" export KUBERNETES_PROVIDER=kubernetes-anywhere - -# This job only runs against the kubernetes repo, and bootstrap.py leaves the -# current working directory at the repository root. Grab the SCM_REVISION so we -# can use the .debs built during the bazel-build job that should have already -# succeeded. -export SCM_VERSION=$(./hack/print-workspace-status.sh | grep ^STABLE_BUILD_SCM_REVISION | cut -d' ' -f2) +# These deliberately do not use the :- syntax so that the nounset flag produces +# succinct errors if either is unset. This job depends on the artifacts created +# during pull-kubernetes-bazel, so these env vars must be set correctly to find +# this pull's build artifacts. +export VERSION=${PULL_NUMBER}/${PULL_REFS} export E2E_NAME="e2e-kubeadm-${BUILD_NUMBER:-0}" export E2E_OPT="--deployment kubernetes-anywhere --kubernetes-anywhere-path /workspace/kubernetes-anywhere" export E2E_OPT+=" --kubernetes-anywhere-phase2-provider kubeadm --kubernetes-anywhere-cluster ${E2E_NAME}" # The gs:// path given here should match jobs/pull-kubernetes-bazel.sh -export E2E_OPT+=" --kubernetes-anywhere-kubeadm-version gs://kubernetes-release-dev/bazel/${SCM_VERSION}/build/debs/" +export E2E_OPT+=" --kubernetes-anywhere-kubeadm-version gs://kubernetes-release-dev/bazel/${VERSION}/build/debs/" export GINKGO_TEST_ARGS="--ginkgo.focus=\[Conformance\]" # Resource leak detection is disabled because prow runs multiple instances of