From ad01c813a0f219d081be0504f2fbb3830415759c Mon Sep 17 00:00:00 2001 From: Drew Walters Date: Thu, 15 Nov 2018 18:25:56 +0000 Subject: [PATCH] zuul: Add site linting gates With the integration of the airskiff site in Treasuremap, there is a need for Zuul site linting gates to ensure that all sites are still syntactically valid when changes are made to global documents. This change introduces linting gates for both treasuremap sites, airskiff and airship-seaworthy. Story: 2004349 Change-Id: I69dc68bf49b02543f8a2def5841dae7cb5824bd6 --- .zuul.yaml | 42 +++++++++++++++++++ tools/gate/lint-site.sh | 26 ++++++++++++ .../airship-seaworthy-site-lint.yaml | 23 ++++++++++ tools/gate/playbooks/airskiff-site-lint.yaml | 23 ++++++++++ tools/gate/playbooks/git-config.yaml | 26 ++++++++++++ tools/gate/playbooks/install-docker.yaml | 30 +++++++++++++ 6 files changed, 170 insertions(+) create mode 100755 tools/gate/lint-site.sh create mode 100644 tools/gate/playbooks/airship-seaworthy-site-lint.yaml create mode 100644 tools/gate/playbooks/airskiff-site-lint.yaml create mode 100644 tools/gate/playbooks/git-config.yaml create mode 100644 tools/gate/playbooks/install-docker.yaml diff --git a/.zuul.yaml b/.zuul.yaml index f0e68376c..44f0b0267 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -15,3 +15,45 @@ - docs-on-readthedocs vars: rtd_webhook_id: '47687' + check: + jobs: + - airship-seaworthy-site-lint-gate + - airskiff-site-lint-gate + gate: + jobs: + - airship-seaworthy-site-lint-gate + - airskiff-site-lint-gate + +- nodeset: + name: airship-treasuremap-single-node + nodes: + - name: primary + label: ubuntu-xenial + +- job: + name: airship-seaworthy-site-lint-gate + nodeset: airship-treasuremap-single-node + timeout: 900 + pre-run: + - tools/gate/playbooks/install-docker.yaml + - tools/gate/playbooks/git-config.yaml + run: tools/gate/playbooks/airship-seaworthy-site-lint.yaml + required-projects: + - openstack/airship-pegleg + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ + +- job: + name: airskiff-site-lint-gate + nodeset: airship-treasuremap-single-node + timeout: 900 + pre-run: + - tools/gate/playbooks/install-docker.yaml + - tools/gate/playbooks/git-config.yaml + run: tools/gate/playbooks/airskiff-site-lint.yaml + required-projects: + - openstack/airship-pegleg + irrelevant-files: + - ^.*\.rst$ + - ^doc/.*$ diff --git a/tools/gate/lint-site.sh b/tools/gate/lint-site.sh new file mode 100755 index 000000000..213a0362f --- /dev/null +++ b/tools/gate/lint-site.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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 + +: "${PEGLEG_PATH:=../airship-pegleg}" +: "${PEGLEG_IMG:=quay.io/airshipit/pegleg:b7556bd89e99f2a6539e97d5a4ac6738751b9c55}" + +: "${PEGLEG:=${PEGLEG_PATH}/tools/pegleg.sh}" + +# TODO(drewwalters96): make Treasuremap sites P001 and P009 compliant. +IMAGE=${PEGLEG_IMG} TERM_OPTS=" " \ + ${PEGLEG} site -r . lint "$1" -x P001 -x P009 diff --git a/tools/gate/playbooks/airship-seaworthy-site-lint.yaml b/tools/gate/playbooks/airship-seaworthy-site-lint.yaml new file mode 100644 index 000000000..e62105b24 --- /dev/null +++ b/tools/gate/playbooks/airship-seaworthy-site-lint.yaml @@ -0,0 +1,23 @@ +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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: primary + tasks: + - name: Lint airship-seaworthy site + shell: | + set -xe; + ./tools/gate/lint-site.sh airship-seaworthy + args: + chdir: "{{ zuul.project.src_dir }}" + become: yes diff --git a/tools/gate/playbooks/airskiff-site-lint.yaml b/tools/gate/playbooks/airskiff-site-lint.yaml new file mode 100644 index 000000000..6ec43e404 --- /dev/null +++ b/tools/gate/playbooks/airskiff-site-lint.yaml @@ -0,0 +1,23 @@ +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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: primary + tasks: + - name: Lint airskiff site + shell: | + set -xe; + ./tools/gate/lint-site.sh airskiff + args: + chdir: "{{ zuul.project.src_dir }}" + become: yes diff --git a/tools/gate/playbooks/git-config.yaml b/tools/gate/playbooks/git-config.yaml new file mode 100644 index 000000000..b0c600593 --- /dev/null +++ b/tools/gate/playbooks/git-config.yaml @@ -0,0 +1,26 @@ +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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: primary + tasks: + - name: Git config + shell: | + set -xe; + + tee .git/config << EOF + [remote "origin"] + url = https://git.openstack.org/openstack/airship-treasuremap.git + EOF + args: + chdir: "{{ zuul.project.src_dir }}" diff --git a/tools/gate/playbooks/install-docker.yaml b/tools/gate/playbooks/install-docker.yaml new file mode 100644 index 000000000..230229190 --- /dev/null +++ b/tools/gate/playbooks/install-docker.yaml @@ -0,0 +1,30 @@ +# Copyright 2018 AT&T Intellectual Property. All other rights reserved. +# +# 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: primary + tasks: + - name: Install Docker CE + shell: | + set -xe; + + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo apt-add-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" + + sudo apt-get update + sudo apt-get install --no-install-recommends -y docker-ce + args: + chdir: "{{ zuul.project.src_dir }}"