[aiab] Add a site linting gate to Zuul

Lint site manifests for Airship in a Bottle when publishing
and merging patches.

The patch adds a pre-run step that generates a new set of
certificates that is required for the validation.

Change-Id: Iebd23dacb424953b95527dd90938f6b6aba93c21
This commit is contained in:
Evgeny L 2019-06-12 19:38:29 +00:00 committed by Kaspars Skels
parent 7a075023f9
commit 82467b9453
3 changed files with 58 additions and 2 deletions

View File

@ -21,12 +21,14 @@
- treasuremap-seaworthy-site-lint
- treasuremap-airskiff-site-lint
- treasuremap-airsloop-site-lint
- treasuremap-aiab-site-lint
- treasuremap-airskiff-deployment-ubuntu
gate:
jobs:
- treasuremap-seaworthy-site-lint
- treasuremap-airskiff-site-lint
- treasuremap-airsloop-site-lint
- treasuremap-aiab-site-lint
- treasuremap-airskiff-deployment-ubuntu
post:
jobs:
@ -67,6 +69,7 @@
- ^doc/.*$
- ^site/airskiff/.*$
- ^site/airsloop/.*$
- ^site/aiab/.*$
- job:
name: treasuremap-airskiff-site-lint
@ -80,6 +83,7 @@
- ^doc/.*$
- ^site/seaworthy/.*$
- ^site/airsloop/.*$
- ^site/aiab/.*$
- job:
name: treasuremap-airsloop-site-lint
@ -93,6 +97,23 @@
- ^doc/.*$
- ^site/seaworthy/.*$
- ^site/airskiff/.*$
- ^site/aiab/.*$
- job:
name: treasuremap-aiab-site-lint
description: |
Lint the aiab site using Pegleg.
parent: treasuremap-site-lint
pre-run:
- tools/gate/playbooks/generate-certs.yaml
vars:
site: aiab
irrelevant-files:
- ^.*\.rst$
- ^doc/.*$
- ^site/seaworthy/.*$
- ^site/airskiff/.*$
- ^site/airsloop/.*$
- job:
name: treasuremap-airskiff-deployment-ubuntu
@ -111,6 +132,7 @@
- ^doc/.*$
- ^site/seaworthy/.*$
- ^site/airsloop/.*$
- ^site/aiab/.*$
- secret:
name: airshipit-github-secret

View File

@ -161,8 +161,10 @@ function install_dependencies() {
}
function run_pegleg_collect() {
# Runs pegleg collect to get the documents combined
pushd ${WORKSPACE}
# Make sure certificates generated during prior runs are deleted.
rm -f treasuremap/site/${TARGET_SITE}/secrets/certificates.yaml
# Run pegleg collect to get the documents combined.
${PEGLEG} site -r /target/treasuremap collect ${TARGET_SITE} -s /target/collected
popd
}
@ -182,7 +184,7 @@ function generate_certs() {
# Generate certificates
${PROMENADE} generate-certs -o /target/genesis /target/genesis/treasuremap.yaml
# Copy the generated certs back into the deployment_files structure
cp genesis/certificates.yaml treasuremap/site/${TARGET_SITE}/secrets
cp genesis/certificates.yaml treasuremap/site/${TARGET_SITE}/secrets/
popd
}
@ -250,6 +252,7 @@ function setup_deploy_site() {
cp ${WORKSPACE}/genesis/*.yaml ${WORKSPACE}/site
print_shipyard_info2
}
function print_shipyard_info2() {
set +x
echo " "

View File

@ -0,0 +1,31 @@
# Copyright 2019 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: ubuntu-xenial
tasks:
- name: Generate site certificates
shell: |
set -xe;
SITE="{{ site }}"
mkdir collected
./tools/airship pegleg site \
-r . collect ${SITE} \
-s /target/collected
./tools/airship promenade generate-certs \
-o /target/site/${SITE}/secrets \
/target/collected/treasuremap.yaml
args:
chdir: "{{ zuul.project.src_dir }}"
become: yes