Skip to content

Commit

Permalink
Allow disabling automatic --repo flag in bazel runner.
Browse files Browse the repository at this point in the history
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
kubernetes#2393.
  • Loading branch information
pipejakob committed Apr 5, 2017
1 parent cead27d commit e8adbd7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion images/pull_kubernetes_bazel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)" .
Expand Down
8 changes: 7 additions & 1 deletion images/pull_kubernetes_bazel/runner
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
"$@"
32 changes: 17 additions & 15 deletions prow/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -821,17 +821,18 @@ 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"
# Bazel needs privileged mode in order to sandbox builds.
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:
Expand All @@ -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:
Expand Down

0 comments on commit e8adbd7

Please sign in to comment.