Adds logging for build flags used
[releng.git] / jjb / apex / apex.yml
1 - project:
2     name: apex
3     jobs:
4         - 'apex-verify-{stream}'
5         - 'apex-merge-{stream}'
6         - 'apex-daily-{stream}'
7
8     # stream:    branch with - in place of / (eg. stable-arno)
9     # branch:    branch (eg. stable/arno)
10     stream:
11         - master:
12             branch: 'master'
13             gs-pathname: ''
14             flags: '-fM'
15             disabled: false
16
17     project: 'apex'
18
19 - job-template:
20     name: 'apex-verify-{stream}'
21
22     node: opnfv-jump-1
23
24     project-type: freestyle
25
26     logrotate:
27         daysToKeep: 30
28         numToKeep: 10
29         artifactDaysToKeep: -1
30         artifactNumToKeep: -1
31
32     parameters:
33         - apex-parameter:
34             gs-pathname: '{gs-pathname}'
35             flags: '{flags}'
36         - project-parameter:
37             project: '{project}'
38         - gerrit-parameter:
39             branch: '{branch}'
40         - string:
41             name: GIT_BASE
42             default: ssh://gerrit.opnfv.org:29418/$PROJECT
43             description: "Used for overriding the GIT URL coming from parameters macro."
44
45     scm:
46         - gerrit-trigger-scm:
47             credentials-id: '{ssh-credentials}'
48             refspec: '$GERRIT_REFSPEC'
49             choosing-strategy: 'gerrit'
50
51     wrappers:
52         - ssh-agent-credentials:
53             user: '{ssh-credentials}'
54
55     triggers:
56         - gerrit:
57             trigger-on:
58                 - patchset-created-event:
59                     exclude-drafts: 'false'
60                     exclude-trivial-rebase: 'false'
61                     exclude-no-code-change: 'false'
62                 - draft-published-event
63                 - comment-added-contains-event:
64                     comment-contains-value: 'recheck'
65                 - comment-added-contains-event:
66                     comment-contains-value: 'reverify'
67             projects:
68               - project-compare-type: 'ANT'
69                 project-pattern: 'apex'
70                 branches:
71                   - branch-compare-type: 'ANT'
72                     branch-pattern: '**/master'
73                 forbidden-file-paths:
74                   - compare-type: ANT
75                     pattern: 'docs/**'
76
77     builders:
78         - 'apex-build'
79         - 'apex-workspace-cleanup'
80
81 - job-template:
82     name: 'apex-merge-{stream}'
83
84     # builder-merge job to run JJB update
85     #
86     # This job's purpose is to update all the JJB
87
88     node: opnfv-jump-1
89
90     project-type: freestyle
91
92     logrotate:
93         daysToKeep: 30
94         numToKeep: 40
95         artifactDaysToKeep: -1
96         artifactNumToKeep: 5
97
98     parameters:
99         - apex-parameter:
100             gs-pathname: '{gs-pathname}'
101             flags: '{flags}'
102         - project-parameter:
103             project: '{project}'
104         - gerrit-parameter:
105             branch: '{branch}'
106         - string:
107             name: GIT_BASE
108             default: ssh://gerrit.opnfv.org:29418/$PROJECT
109             description: "Used for overriding the GIT URL coming from parameters macro."
110
111     scm:
112         - gerrit-trigger-scm:
113             credentials-id: '{ssh-credentials}'
114             refspec: ''
115             choosing-strategy: 'default'
116
117     wrappers:
118         - ssh-agent-credentials:
119             user: '{ssh-credentials}'
120
121     triggers:
122         - gerrit:
123             trigger-on:
124                 - change-merged-event
125                 - comment-added-contains-event:
126                     comment-contains-value: 'remerge'
127             projects:
128               - project-compare-type: 'ANT'
129                 project-pattern: 'apex'
130                 branches:
131                     - branch-compare-type: 'ANT'
132                       branch-pattern: '**/master'
133                 forbidden-file-paths:
134                   - compare-type: ANT
135                     pattern: 'docs/**'
136
137     builders:
138         - 'apex-build'
139         - 'apex-workspace-cleanup'
140
141 - job-template:
142     name: 'apex-daily-{stream}'
143
144     # Job template for daily builders
145     #
146     # Required Variables:
147     #     stream:    branch with - in place of / (eg. stable)
148     #     branch:    branch (eg. stable)
149     node: opnfv-jump-1
150
151     disabled: true
152
153     project-type: freestyle
154
155     logrotate:
156         daysToKeep: '{build-days-to-keep}'
157         numToKeep: '{build-num-to-keep}'
158         artifactDaysToKeep: '{build-artifact-days-to-keep}'
159         artifactNumToKeep: '{build-artifact-num-to-keep}'
160
161     parameters:
162         - project-parameter:
163             project: '{project}'
164         - apex-parameter:
165             gs-pathname: '{gs-pathname}'
166             flags: '{flags}'
167
168     scm:
169         - git-scm:
170             credentials-id: '{ssh-credentials}'
171             refspec: ''
172             branch: '{branch}'
173
174     wrappers:
175         - ssh-agent-credentials:
176             user: '{ssh-credentials}'
177
178     triggers:
179         - 'apex-{stream}'
180
181     builders:
182         - 'apex-build'
183         - 'apex-upload-artifact'
184         - 'apex-workspace-cleanup'
185
186 ########################
187 # parameter macros
188 ########################
189 - parameter:
190     name: apex-parameter
191     parameters:
192         - string:
193             name: BUILD_DIRECTORY
194             default: $WORKSPACE/build_output
195             description: "Directory where the build artifact will be located upon the completion of the build."
196         - string:
197             name: CACHE_DIRECTORY
198             default: $HOME/opnfv/cache/{gs-pathname}
199             description: "Directory where the cache to be used during the build is located."
200         - string:
201             name: GIT_BASE
202             default: https://gerrit.opnfv.org/gerrit/$PROJECT
203             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
204         - string:
205             name: GS_URL
206             default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
207             description: "URL to Google Storage."
208         - string:
209             name: FLAGS
210             default: '{flags}'
211             description: "Build Flags"
212
213 ########################
214 # builder macros
215 ########################
216 - builder:
217     name: 'apex-build'
218     builders:
219         - shell: |
220             #!/bin/bash
221             set -o errexit
222             set -o nounset
223             set -o pipefail
224             # log info to console
225             echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
226             echo "---------------------------------------------------------------------------------------"
227             echo "Build flags for this build are ${FLAGS}"
228             echo "---------------------------------------------------------------------------------------"
229             echo
230             # create the cache directory if it doesn't exist
231             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
232             # set OPNFV_ARTIFACT_VERSION
233             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
234             # start the build
235             cd $WORKSPACE/ci
236             ./build.sh $FLAGS -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
237             # list the contents of BUILD_OUTPUT directory
238             ls -al $BUILD_DIRECTORY
239             # save information regarding artifact into file
240             (
241                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
242                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
243                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
244                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
245                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
246                 echo "OPNFV_BUILD_URL=$BUILD_URL"
247             ) > $WORKSPACE/opnfv.properties
248             echo
249             echo "--------------------------------------------------------"
250
251 - builder:
252     name: 'apex-workspace-cleanup'
253     builders:
254         - shell: |
255             #!/bin/bash
256             set -o errexit
257             set -o nounset
258             set -o pipefail
259
260             # delete everything that is in $WORKSPACE
261             /bin/rm -rf $WORKSPACE
262
263 - builder:
264     name: 'apex-upload-artifact'
265     builders:
266         - shell: |
267             #!/bin/bash
268             set -o errexit
269             set -o nounset
270             set -o pipefail
271
272             # log info to console
273             echo "Uploading the Apex artifact. This could take some time..."
274             echo "--------------------------------------------------------"
275             echo
276
277             # source the opnfv.properties to get ARTIFACT_VERSION
278             source $WORKSPACE/opnfv.properties
279
280             # upload artifact and additional files to google storage
281             gsutil cp $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
282             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
283             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
284
285             echo
286             echo "--------------------------------------------------------"
287             echo "Done!"
288             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
289
290
291 #######################
292 # trigger macros
293 ########################
294 - trigger:
295     name: 'apex-master'
296     triggers:
297         - timed: '0 11 * * *'
298