Browse Source

[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
tags/v1.2
Evgeny L 1 month ago
parent
commit
82467b9453

+ 22
- 0
.zuul.yaml View File

@@ -21,12 +21,14 @@
21 21
         - treasuremap-seaworthy-site-lint
22 22
         - treasuremap-airskiff-site-lint
23 23
         - treasuremap-airsloop-site-lint
24
+        - treasuremap-aiab-site-lint
24 25
         - treasuremap-airskiff-deployment-ubuntu
25 26
     gate:
26 27
       jobs:
27 28
         - treasuremap-seaworthy-site-lint
28 29
         - treasuremap-airskiff-site-lint
29 30
         - treasuremap-airsloop-site-lint
31
+        - treasuremap-aiab-site-lint
30 32
         - treasuremap-airskiff-deployment-ubuntu
31 33
     post:
32 34
       jobs:
@@ -67,6 +69,7 @@
67 69
       - ^doc/.*$
68 70
       - ^site/airskiff/.*$
69 71
       - ^site/airsloop/.*$
72
+      - ^site/aiab/.*$
70 73
 
71 74
 - job:
72 75
     name: treasuremap-airskiff-site-lint
@@ -80,6 +83,7 @@
80 83
       - ^doc/.*$
81 84
       - ^site/seaworthy/.*$
82 85
       - ^site/airsloop/.*$
86
+      - ^site/aiab/.*$
83 87
 
84 88
 - job:
85 89
     name: treasuremap-airsloop-site-lint
@@ -93,6 +97,23 @@
93 97
       - ^doc/.*$
94 98
       - ^site/seaworthy/.*$
95 99
       - ^site/airskiff/.*$
100
+      - ^site/aiab/.*$
101
+
102
+- job:
103
+    name: treasuremap-aiab-site-lint
104
+    description: |
105
+      Lint the aiab site using Pegleg.
106
+    parent: treasuremap-site-lint
107
+    pre-run:
108
+      - tools/gate/playbooks/generate-certs.yaml
109
+    vars:
110
+      site: aiab
111
+    irrelevant-files:
112
+      - ^.*\.rst$
113
+      - ^doc/.*$
114
+      - ^site/seaworthy/.*$
115
+      - ^site/airskiff/.*$
116
+      - ^site/airsloop/.*$
96 117
 
97 118
 - job:
98 119
     name: treasuremap-airskiff-deployment-ubuntu
@@ -111,6 +132,7 @@
111 132
       - ^doc/.*$
112 133
       - ^site/seaworthy/.*$
113 134
       - ^site/airsloop/.*$
135
+      - ^site/aiab/.*$
114 136
 
115 137
 - secret:
116 138
     name: airshipit-github-secret

+ 5
- 2
tools/deployment/aiab/common/deploy-airship.sh View File

@@ -161,8 +161,10 @@ function install_dependencies() {
161 161
 }
162 162
 
163 163
 function run_pegleg_collect() {
164
-  # Runs pegleg collect to get the documents combined
165 164
   pushd ${WORKSPACE}
165
+  # Make sure certificates generated during prior runs are deleted.
166
+  rm -f treasuremap/site/${TARGET_SITE}/secrets/certificates.yaml
167
+  # Run pegleg collect to get the documents combined.
166 168
   ${PEGLEG} site -r /target/treasuremap collect ${TARGET_SITE} -s /target/collected
167 169
   popd
168 170
 }
@@ -182,7 +184,7 @@ function generate_certs() {
182 184
   # Generate certificates
183 185
   ${PROMENADE} generate-certs -o /target/genesis /target/genesis/treasuremap.yaml
184 186
   # Copy the generated certs back into the deployment_files structure
185
-  cp genesis/certificates.yaml treasuremap/site/${TARGET_SITE}/secrets
187
+  cp genesis/certificates.yaml treasuremap/site/${TARGET_SITE}/secrets/
186 188
   popd
187 189
 }
188 190
 
@@ -250,6 +252,7 @@ function setup_deploy_site() {
250 252
   cp ${WORKSPACE}/genesis/*.yaml ${WORKSPACE}/site
251 253
   print_shipyard_info2
252 254
 }
255
+
253 256
 function print_shipyard_info2() {
254 257
   set +x
255 258
   echo " "

+ 31
- 0
tools/gate/playbooks/generate-certs.yaml View File

@@ -0,0 +1,31 @@
1
+# Copyright 2019 AT&T Intellectual Property.  All other rights reserved.
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License");
4
+# you may not use this file except in compliance with the License.
5
+# You may obtain a copy of the License at
6
+#
7
+#     http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS,
11
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+# See the License for the specific language governing permissions and
13
+# limitations under the License.
14
+
15
+- hosts: ubuntu-xenial
16
+  tasks:
17
+    - name: Generate site certificates
18
+      shell: |
19
+        set -xe;
20
+        SITE="{{ site }}"
21
+
22
+        mkdir collected
23
+        ./tools/airship pegleg site \
24
+          -r . collect ${SITE} \
25
+          -s /target/collected
26
+        ./tools/airship promenade generate-certs \
27
+          -o /target/site/${SITE}/secrets \
28
+          /target/collected/treasuremap.yaml
29
+      args:
30
+        chdir: "{{ zuul.project.src_dir }}"
31
+      become: yes

Loading…
Cancel
Save