From e8adbd7b221ba008d9cc5f2074c64b980ef4d86f Mon Sep 17 00:00:00 2001 From: Jacob Beacham Date: Wed, 5 Apr 2017 14:18:11 -0700 Subject: [PATCH] Allow disabling automatic --repo flag in bazel runner. If a periodic job uses the bazelbuild image and passes an argument of "--repo=...", it ends up getting appended to the list of repos instead of overwriting it. This change lets jobs set an environment variable to opt out of this automatic --repo flag added by the bazel runner. This also reverts the attempted (failed) workaround from https://github.com/kubernetes/test-infra/pull/2393. --- images/pull_kubernetes_bazel/Makefile | 2 +- images/pull_kubernetes_bazel/runner | 8 ++++++- prow/config.yaml | 32 ++++++++++++++------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/images/pull_kubernetes_bazel/Makefile b/images/pull_kubernetes_bazel/Makefile index 62dfbb00e943..c7f6907747d9 100644 --- a/images/pull_kubernetes_bazel/Makefile +++ b/images/pull_kubernetes_bazel/Makefile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -VERSION = 0.11 +VERSION = 0.12 image: docker build -t "gcr.io/k8s-testimages/bazelbuild:$(VERSION)" . diff --git a/images/pull_kubernetes_bazel/runner b/images/pull_kubernetes_bazel/runner index f6e53d81a3f6..1b2b1638841a 100755 --- a/images/pull_kubernetes_bazel/runner +++ b/images/pull_kubernetes_bazel/runner @@ -17,9 +17,15 @@ set -o errexit set -o nounset set -o pipefail +# Since the --repo flag appends values instead of overwriting them, let jobs +# indicate that the runner should not to add this flag itself. +if [ "${DISABLE_AUTO_REPO:-}" != "y" ]; then + FLAGS=--repo="k8s.io/${REPO_NAME:-test-infra}" +fi + git clone https://github.com/kubernetes/test-infra ./test-infra/jenkins/bootstrap.py \ - --repo="k8s.io/${REPO_NAME:-test-infra}" \ + ${FLAGS:-} \ --job=${JOB_NAME} \ --service-account=${GOOGLE_APPLICATION_CREDENTIALS} \ "$@" diff --git a/prow/config.yaml b/prow/config.yaml index f61b1c67b6a3..683f3edb4758 100644 --- a/prow/config.yaml +++ b/prow/config.yaml @@ -52,7 +52,7 @@ presubmits: - master spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--pull=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/pr-logs" @@ -226,7 +226,7 @@ presubmits: - master spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--pull=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/pr-logs" @@ -400,7 +400,7 @@ presubmits: trigger: "@k8s-bot (bazel )?test this" spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--pull=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/pr-logs" @@ -490,7 +490,7 @@ postsubmits: - master spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--branch=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/logs" @@ -519,7 +519,7 @@ postsubmits: - name: ci-kubernetes-bazel-test spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--branch=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/logs" @@ -587,7 +587,7 @@ postsubmits: - release-1.6 spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.9 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--branch=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/logs" @@ -616,7 +616,7 @@ postsubmits: - name: ci-kubernetes-bazel-test-1-6 spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.9 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--branch=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/logs" @@ -686,7 +686,7 @@ postsubmits: - master spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--branch=$(PULL_REFS)" - "--upload=gs://kubernetes-jenkins/logs" @@ -739,7 +739,7 @@ periodics: interval: 1h spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.11 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: - "--branch=master" - "--upload=gs://kubernetes-jenkins/logs" @@ -821,8 +821,9 @@ periodics: interval: 2h spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.9 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: + - "--repo=k8s.io/kubernetes=release-1.6" - "--upload=gs://kubernetes-jenkins/logs" - "--git-cache=/root/.cache/git" - "--clean" @@ -830,8 +831,8 @@ periodics: securityContext: privileged: true env: - - name: REPO_NAME - value: kubernetes=release-1.6 + - name: DISABLE_AUTO_REPO + value: y - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/service-account/service-account.json volumeMounts: @@ -851,16 +852,17 @@ periodics: - name: periodic-kubernetes-bazel-test-1-6 spec: containers: - - image: gcr.io/k8s-testimages/bazelbuild:0.9 + - image: gcr.io/k8s-testimages/bazelbuild:0.12 args: + - "--repo=k8s.io/kubernetes=release-1.6" - "--upload=gs://kubernetes-jenkins/logs" - "--git-cache=/root/.cache/git" - "--clean" securityContext: privileged: true env: - - name: REPO_NAME - value: kubernetes=release-1.6 + - name: DISABLE_AUTO_REPO + value: y - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/service-account/service-account.json volumeMounts: