Added YAML file linting

Change-Id: I17208c96610ee13772c44b7d765d3014f0023134
This commit is contained in:
Raven Daugherty 2019-11-05 15:27:53 -06:00 committed by Alexander Hughes
parent 1a1c31b5a7
commit 158768278e
6 changed files with 82 additions and 1 deletions

View File

@ -27,6 +27,8 @@
- airship-pegleg-docker-build-gate-ubuntu_xenial
- airship-pegleg-docker-build-gate-ubuntu_bionic
- airship-pegleg-docker-build-gate-opensuse
- airship-pegleg-lint-yaml
gate:
jobs:
- openstack-tox-pep8
@ -34,6 +36,7 @@
- airship-pegleg-docker-build-gate-ubuntu_xenial
- airship-pegleg-docker-build-gate-ubuntu_bionic
- airship-pegleg-docker-build-gate-opensuse
- airship-pegleg-lint-yaml
post:
jobs:
- airship-pegleg-docker-publish-ubuntu_xenial
@ -47,6 +50,16 @@
- name: primary
label: ubuntu-xenial
- job:
name: airship-pegleg-lint-yaml
voting: true
timeout: 600
run: tools/gate/playbooks/lint-yaml.yaml
nodeset: ubuntu-bionic
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- job:
name: pegleg-dependency-vulnerability-check
parent: tox-py36

View File

@ -100,4 +100,3 @@ required:
- name
- layeringDefinition
- storagePolicy

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

@ -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.projects['opendev.org/airship/pegleg'].src_dir }}"

View File

@ -0,0 +1,19 @@
# 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
rules:
line-length:
max: 80
level: warning