diff --git a/hack/build-then-unit.sh b/hack/build-then-unit.sh new file mode 100755 index 0000000000000..29accbfe7fc50 --- /dev/null +++ b/hack/build-then-unit.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Copyright 2018 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# used in presubmits / CI testing +# bazel build then unit test, exiting non-zero if either failed + +local res=0 + +bazel build //... +if [[ $? -ne 0 ]]; then + res=1 +fi + +bazel test //... --config=unit +if [[ $? -ne 0 ]]; then + res=1 +fi + +exit $res diff --git a/prow/config.yaml b/prow/config.yaml index 4427e673f3eda..7021a72b86e72 100644 --- a/prow/config.yaml +++ b/prow/config.yaml @@ -4800,8 +4800,6 @@ presubmits: - name: pull-test-infra-bazel-canary agent: kubernetes context: pull-test-infra-bazel-canary - branches: - - master always_run: false rerun_command: "/test pull-test-infra-bazel-canary" trigger: "(?m)^/test pull-test-infra-bazel-canary,?(\\s+|$)" @@ -4818,11 +4816,9 @@ presubmits: - "--repo=k8s.io/$(REPO_NAME)=$(PULL_REFS)" - "--service-account=/etc/service-account/service-account.json" - "--upload=gs://kubernetes-jenkins/pr-logs" + - "--scenario=kubernetes_execute_bazel" - "--" # end bootstrap args, scenario args below - - "--build=//..." - - "--install=gubernator/test_requirements.txt" - - "--test=//..." - - "--test-args=--test_output=errors" + - "hack/build-then-unit.sh" env: - name: BAZEL_REMOTE_CACHE_ENABLED value: "true" @@ -4863,6 +4859,42 @@ presubmits: hostPath: path: /mnt/disks/ssd0 + - name: pull-test-infra-lint + agent: kubernetes + context: pull-test-infra-lint + # TODO(bentheelder): set always_run once we've switched over to use --config=unit for the bazel job + always_run: false + rerun_command: "/test pull-test-infra-lint-canary" + trigger: "(?m)^/test pull-test-infra-lint-canary,?(\\s+|$)" + labels: + preset-service-account: true + preset-bazel-scratch-dir: true + spec: + containers: + - image: gcr.io/k8s-testimages/kubekins-e2e:latest-experimental + imagePullPolicy: Always + args: + - "--clean" + - "--job=$(JOB_NAME)" + - "--repo=k8s.io/$(REPO_NAME)=$(PULL_REFS)" + - "--service-account=/etc/service-account/service-account.json" + - "--upload=gs://kubernetes-jenkins/pr-logs" + - "--scenario=kubernetes_" + - "--" # end bootstrap args, scenario args below + - "--install=gubernator/test_requirements.txt" + - "--test=//..." + - "--test-args=--config=lint" + env: + - name: BAZEL_REMOTE_CACHE_ENABLED + value: "true" + # Bazel needs privileged mode in order to sandbox builds. + securityContext: + privileged: true + volumeMounts: + resources: + requests: + memory: "2Gi" + - name: pull-test-infra-verify-bazel agent: kubernetes context: pull-test-infra-verify-bazel diff --git a/testgrid/config.yaml b/testgrid/config.yaml index 2a08d6a5308be..e73cc8a58674b 100644 --- a/testgrid/config.yaml +++ b/testgrid/config.yaml @@ -1856,6 +1856,10 @@ test_groups: gcs_prefix: kubernetes-jenkins/pr-logs/directory/pull-test-infra-bazel-canary days_of_results: 1 num_columns_recent: 20 +- name: pull-test-infra-lint + gcs_prefix: kubernetes-jenkins/pr-logs/directory/pull-test-infra-lint + days_of_results: 1 + num_columns_recent: 20 - name: pull-test-infra-gubernator gcs_prefix: kubernetes-jenkins/pr-logs/directory/pull-test-infra-gubernator days_of_results: 1 @@ -5079,6 +5083,11 @@ dashboards: base_options: 'width=10' alerts_options: alert_mail_to_addresses: 'bentheelder+alerts@google.com' + - name: lint + test_group_name: pull-test-infra-lint + base_options: 'width=10' + alerts_options: + alert_mail_to_addresses: 'bentheelder+alerts@google.com' - name: bazel-canary test_group_name: pull-test-infra-bazel-canary base_options: 'width=10'