From 41bdf9f90128312b0d02c404ddbbaf69ec5a4b97 Mon Sep 17 00:00:00 2001 From: Jacob Beacham Date: Wed, 5 Apr 2017 14:18:11 -0700 Subject: [PATCH] Make bazel runner tolerant of periodic jobs. 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 is to make the runner detect if it's being run in a periodic context, and if so, not add its own --repo flag. 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 | 10 +++++++++- prow/config.yaml | 28 +++++++++++++-------------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/images/pull_kubernetes_bazel/Makefile b/images/pull_kubernetes_bazel/Makefile index 62dfbb00e9431..c7f6907747d90 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 f6e53d81a3f67..c6c78c310d200 100755 --- a/images/pull_kubernetes_bazel/runner +++ b/images/pull_kubernetes_bazel/runner @@ -17,9 +17,17 @@ set -o errexit set -o nounset set -o pipefail +# Only add the --repo flag if this image is used during a presubmit/postsubmit +# job. Periodic jobs pass --repo explicitly, which will append to the value +# (instead of overwriting it) if the runner also specifies it, which is +# generally undesired for periodic jobs. +if [ "${PULL_REFS:-}" != ":" ]; 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 f61b1c67b6a37..90032dca08309 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,6 @@ periodics: securityContext: privileged: true env: - - name: REPO_NAME - value: kubernetes=release-1.6 - name: GOOGLE_APPLICATION_CREDENTIALS value: /etc/service-account/service-account.json volumeMounts: @@ -851,16 +850,15 @@ 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: GOOGLE_APPLICATION_CREDENTIALS value: /etc/service-account/service-account.json volumeMounts: