Filter out added/modified *.ipynb for preview job
[releng.git] / jjb / qtip / qtip-verify-jobs.yml
1 ---
2 ######################
3 # verify before MERGE
4 ######################
5
6 - project:
7     name: qtip-verify-jobs
8     project: qtip
9     jobs:
10       - 'qtip-verify-{stream}'
11       - 'qtip-verify-notebook-{stream}'
12       - 'qtip-merged-notebook-{stream}'
13     stream:
14       - master:
15           branch: '{stream}'
16           gs-pathname: ''
17           disabled: false
18       - euphrates:
19           branch: 'stable/{stream}'
20           gs-pathname: '/{stream}'
21           disabled: false
22
23 ################################
24 ## job templates
25 #################################
26 - job-template:
27     name: 'qtip-verify-{stream}'
28
29     disabled: '{obj:disabled}'
30
31     parameters:
32       - project-parameter:
33           project: '{project}'
34           branch: '{branch}'
35       - 'opnfv-build-ubuntu-defaults'
36
37     scm:
38       - git-scm-gerrit
39
40     triggers:
41       - gerrit:
42           server-name: 'gerrit.opnfv.org'
43           trigger-on:
44             - patchset-created-event:
45                 exclude-drafts: 'false'
46                 exclude-trivial-rebase: 'false'
47                 exclude-no-code-change: 'false'
48             - draft-published-event
49             - comment-added-contains-event:
50                 comment-contains-value: 'recheck'
51             - comment-added-contains-event:
52                 comment-contains-value: 'reverify'
53           projects:
54             - project-compare-type: 'ANT'
55               project-pattern: '{project}'
56               branches:
57                 - branch-compare-type: 'ANT'
58                   branch-pattern: '**/{branch}'
59               disable-strict-forbidden-file-verification: 'true'
60               forbidden-file-paths:
61                 - compare-type: ANT
62                   pattern: 'docs/**|.gitignore'
63
64     builders:
65       - qtip-unit-tests-and-docs-build
66     publishers:
67       - publish-coverage
68       - email-jenkins-admins-on-failure
69
70 # upload juypter notebook to artifacts for review
71 - job-template:
72     name: 'qtip-verify-notebook-{stream}'
73
74     disabled: '{obj:disabled}'
75
76     parameters:
77       - project-parameter:
78           project: '{project}'
79           branch: '{branch}'
80       - 'opnfv-build-ubuntu-defaults'
81
82     scm:
83       - git-scm-gerrit
84
85     triggers:
86       - gerrit:
87           server-name: 'gerrit.opnfv.org'
88           trigger-on:
89             - patchset-created-event:
90                 exclude-drafts: 'false'
91                 exclude-trivial-rebase: 'false'
92                 exclude-no-code-change: 'false'
93             - draft-published-event
94             - comment-added-contains-event:
95                 comment-contains-value: 'recheck'
96             - comment-added-contains-event:
97                 comment-contains-value: 'reverify'
98           projects:
99             - project-compare-type: 'ANT'
100               project-pattern: '{project}'
101               branches:
102                 - branch-compare-type: 'ANT'
103                   branch-pattern: '**/{branch}'
104               disable-strict-forbidden-file-verification: 'true'
105               file-paths:
106                 - compare-type: ANT
107                   pattern: '**/*.ipynb'
108
109     builders:
110       - upload-under-review-notebooks-to-opnfv-artifacts
111       - report-build-result-to-gerrit
112
113 - job-template:
114     name: 'qtip-merged-notebook-{stream}'
115
116     disabled: '{obj:disabled}'
117
118     parameters:
119       - project-parameter:
120           project: $GERRIT_PROJECT
121           branch: '{branch}'
122       - string:
123           name: GS_URL
124           default: '$GS_BASE{gs-pathname}'
125           description: "Directory where the build artifact will be located upon the completion of the build."
126       - string:
127           name: GERRIT_REFSPEC
128           default: 'refs/heads/{branch}'
129           description: "JJB configured GERRIT_REFSPEC parameter"
130
131     scm:
132       - git-scm
133
134     triggers:
135       - gerrit:
136           server-name: 'gerrit.opnfv.org'
137           trigger-on:
138             - change-merged-event
139             - comment-added-contains-event:
140                 comment-contains-value: 'remerge'
141           projects:
142             - project-compare-type: 'ANT'
143               project-pattern: '*'
144               branches:
145                 - branch-compare-type: 'ANT'
146                   branch-pattern: '**/{branch}'
147               file-paths:
148                 - compare-type: ANT
149                   pattern: '**/*ipynb'
150
151     builders:
152       - remove-old-docs-from-opnfv-artifacts
153
154 ################################
155 ## job builders
156 #################################
157 - builder:
158     name: qtip-unit-tests-and-docs-build
159     builders:
160       - shell: |
161           #!/bin/bash
162           set -o errexit
163           set -o pipefail
164           set -o xtrace
165
166           tox
167
168 # modified from upload-under-review-docs-to-opnfv-artifacts
169 # in global/releng-macro.yml
170 - builder:
171     name: upload-under-review-notebooks-to-opnfv-artifacts
172     builders:
173       - shell: |
174           #!/bin/bash
175           set -o errexit
176           set -o pipefail
177           set -o xtrace
178           export PATH=$PATH:/usr/local/bin/
179
180           [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
181
182           echo
183           echo "###########################"
184           echo "UPLOADING DOCS UNDER REVIEW"
185           echo "###########################"
186           echo
187
188           gs_base="artifacts.opnfv.org/$PROJECT/review"
189           gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
190           local_path="upload/$GERRIT_CHANGE_NUMBER"
191
192           mkdir -p $local_path
193
194           git diff HEAD~1 --name-status | grep -E "[AM]\t.+\.ipynb$" | awk '{print $2}' \
195             | xargs -I '{}' cp '{}' $local_path
196           gsutil -m cp -r "$local_path" "gs://$gs_base/"
197
198           echo "Document link(s):" >> gerrit_comment.txt
199           find "$local_path" | grep -e 'ipynb$' | \
200               sed -e "s|^$local_path|    https://nbviewer.jupyter.org/url/$gs_path|" >> gerrit_comment.txt