Skip to content

Commit

Permalink
Add linter test for prow (#14934)
Browse files Browse the repository at this point in the history
* Add linter test for prow

* chmod
  • Loading branch information
howardjohn authored and Francois Pesce committed Jun 18, 2019
1 parent 9b56875 commit c36221b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,14 @@ fmt:
buildcache:
GOBUILDFLAGS=-i $(MAKE) build

JUNIT_LINT_TEST_XML ?= $(ISTIO_OUT)/junit_lint-tests.xml
# Existence of build cache .a files actually affects the results of
# some linters; they need to exist.
lint: buildcache
SKIP_INIT=1 bin/linters.sh
lint: $(JUNIT_REPORT) buildcache
mkdir -p $(dir $(JUNIT_LINT_TEST_XML))
set -o pipefail; \
SKIP_INIT=1 bin/linters.sh \
2>&1 | tee >($(JUNIT_REPORT) > $(JUNIT_LINT_TEST_XML))

# @todo gometalinter targets?

Expand Down
37 changes: 37 additions & 0 deletions prow/istio-lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Copyright 2019 Istio 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.

WD=$(dirname "$0")
WD=$(cd "$WD"; pwd)
ROOT=$(dirname "$WD")

# No unset vars, print commands as they're executed, and exit on any non-zero
# return code
set -u
set -x
set -e

# shellcheck source=prow/lib.sh
source "${ROOT}/prow/lib.sh"
setup_and_export_git_sha

cd "${ROOT}"

# Unit tests are run against a local apiserver and etcd.
# Integration/e2e tests in the other scripts are run against GKE or real clusters.
JUNIT_LINT_TEST_XML="${ARTIFACTS_DIR}/junit_lint-tests.xml" \
T="-v" \
make localTestEnv lint

0 comments on commit c36221b

Please sign in to comment.