Added YAML file linting to maas

Change-Id: I4711ad587d903e25bd59cd5cae75841166340a84
This commit is contained in:
Raven Daugherty 2019-12-09 19:41:28 -06:00 committed by Drew Walters
parent 0a8b01bb72
commit dae2fda64e
6 changed files with 81 additions and 1 deletions

View File

@ -17,11 +17,13 @@
- airship-maas-chart-build-gate
- airship-maas-chart-build-latest-htk
- airship-maas-docker-build-gate
- airship-maas-lint-yaml
gate:
jobs:
- airship-maas-lint-ws
- airship-maas-chart-build-gate
- airship-maas-docker-build-gate
- airship-maas-lint-yaml
post:
jobs:
- airship-maas-docker-publish
@ -71,6 +73,15 @@
dynamic:
patch_set: true
- job:
name: airship-maas-lint-yaml
voting: true
timeout: 900
run: tools/gate/playbooks/lint-yaml.yaml
nodeset: ubuntu-bionic
irrelevant-files:
- '^charts/maas/templates/.*'
- job:
name: airship-maas-docker-publish
timeout: 1800

16
tools/gate/install-yaml-lint.sh Executable file
View File

@ -0,0 +1,16 @@
# 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.
set -xe
sudo apt-get update
sudo apt-get install --no-install-recommends -y yamllint

13
tools/gate/lint-yaml.sh Executable file
View File

@ -0,0 +1,13 @@
# 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.
yamllint -c ./tools/gate/playbooks/yamllint-config.yaml .

View File

@ -1,4 +1,3 @@
# 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

View File

@ -0,0 +1,21 @@
# 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.
- hosts: ubuntu-bionic
tasks:
- name: lint-yaml
shell: |
set -xe;
./tools/gate/install-yaml-lint.sh
./tools/gate/lint-yaml.sh
args:
chdir: "{{ zuul.project.src_dir }}"

View File

@ -0,0 +1,20 @@
# 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.
---
extends: default
ignore:
/charts/maas/templates/
rules:
line-length:
max: 80
level: warning