blob: 033c13e879557c92a07f16777bfc27db6dfb5bb2 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
2# Copyright 2017-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16
Zack Williams1aaa3b12016-09-01 09:55:17 -070017#!/usr/bin/env bash
18set +e
19fail_ansible=0
20
21# verify that we have ansible-lint installed
22command -v ansible-lint >/dev/null 2>&1 || { echo "ansible-lint not found, please install it" >&2; exit 1; }
23
24# when not running under Jenkins, use current dir as workspace
25WORKSPACE=${WORKSPACE:-.}
26
27echo "=> Linting Ansible Code with" `ansible-lint --version`
28for f in `find $WORKSPACE -name "*.yml"`; do
29 echo "==> CHECKING: $f"
30 ansible-lint -p $f
31 rc=$?
32 if [[ $rc != 0 ]]; then
33 echo "==> LINTING FAIL: $f"
34 fail_ansible=1
35 fi
36done
37
38exit 0