diff --git a/.zuul.yaml b/.zuul.yaml index 41999d40..92ad1c07 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -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 diff --git a/pegleg/schemas/deckhand-metadata-document.yaml b/pegleg/schemas/deckhand-metadata-document.yaml index 7a6393b8..c78c24fd 100644 --- a/pegleg/schemas/deckhand-metadata-document.yaml +++ b/pegleg/schemas/deckhand-metadata-document.yaml @@ -100,4 +100,3 @@ required: - name - layeringDefinition - storagePolicy - diff --git a/tools/gate/install-yaml-lint.sh b/tools/gate/install-yaml-lint.sh new file mode 100755 index 00000000..cf7dceba --- /dev/null +++ b/tools/gate/install-yaml-lint.sh @@ -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 diff --git a/tools/gate/lint-yaml.sh b/tools/gate/lint-yaml.sh new file mode 100755 index 00000000..bf97e945 --- /dev/null +++ b/tools/gate/lint-yaml.sh @@ -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 . diff --git a/tools/gate/playbooks/lint-yaml.yaml b/tools/gate/playbooks/lint-yaml.yaml new file mode 100644 index 00000000..3a4b083f --- /dev/null +++ b/tools/gate/playbooks/lint-yaml.yaml @@ -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 }}" diff --git a/tools/gate/playbooks/yamllint-config.yaml b/tools/gate/playbooks/yamllint-config.yaml new file mode 100644 index 00000000..2b05859b --- /dev/null +++ b/tools/gate/playbooks/yamllint-config.yaml @@ -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