adding Apex rpm references to Apex builds
[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: false
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         - gerrit-parameter:
168             branch: '{branch}'
169         - string:
170             name: GIT_BASE
171             default: ssh://gerrit.opnfv.org:29418/$PROJECT
172             description: "Used for overriding the GIT URL coming from parameters macro."
173
174     scm:
175         - git-scm:
176             credentials-id: '{ssh-credentials}'
177             refspec: ''
178             branch: '{branch}'
179
180     wrappers:
181         - ssh-agent-credentials:
182             user: '{ssh-credentials}'
183
184     triggers:
185         - 'apex-{stream}'
186
187     builders:
188         - 'apex-build'
189         - 'apex-upload-artifact'
190         - 'apex-workspace-cleanup'
191
192 ########################
193 # parameter macros
194 ########################
195 - parameter:
196     name: apex-parameter
197     parameters:
198         - string:
199             name: BUILD_DIRECTORY
200             default: $WORKSPACE/build_output
201             description: "Directory where the build artifact will be located upon the completion of the build."
202         - string:
203             name: CACHE_DIRECTORY
204             default: $HOME/opnfv/cache/{gs-pathname}
205             description: "Directory where the cache to be used during the build is located."
206         - string:
207             name: GIT_BASE
208             default: https://gerrit.opnfv.org/gerrit/$PROJECT
209             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
210         - string:
211             name: GS_URL
212             default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
213             description: "URL to Google Storage."
214         - string:
215             name: FLAGS
216             default: '{flags}'
217             description: "Build Flags"
218
219 ########################
220 # builder macros
221 ########################
222 - builder:
223     name: 'apex-build'
224     builders:
225         - shell: |
226             #!/bin/bash
227             set -o errexit
228             set -o nounset
229             set -o pipefail
230             # log info to console
231             echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
232             echo "---------------------------------------------------------------------------------------"
233             echo "Build flags for this build are ${FLAGS}"
234             echo "---------------------------------------------------------------------------------------"
235             echo
236             # create the cache directory if it doesn't exist
237             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
238             # set OPNFV_ARTIFACT_VERSION
239             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
240             # start the build
241             cd $WORKSPACE/ci
242             ./build.sh $FLAGS -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
243             # list the contents of BUILD_OUTPUT directory
244             ls -al $BUILD_DIRECTORY
245             # save information regarding artifact into file
246             (
247                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
248                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
249                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
250                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
251                 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
252                 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$(grep Version build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '-_').src.rpm"
253                 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$(grep Version build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '-_').rpm"
254                 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/$(grep Version build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '-_').rpm)"
255                 echo "OPNFV_BUILD_URL=$BUILD_URL"
256             ) > $WORKSPACE/opnfv.properties
257             echo
258             echo "--------------------------------------------------------"
259
260 - builder:
261     name: 'apex-workspace-cleanup'
262     builders:
263         - shell: |
264             #!/bin/bash
265             set -o errexit
266             set -o nounset
267             set -o pipefail
268
269             # delete everything that is in $WORKSPACE
270             /bin/rm -rf $WORKSPACE
271
272 - builder:
273     name: 'apex-upload-artifact'
274     builders:
275         - shell: |
276             #!/bin/bash
277             set -o errexit
278             set -o nounset
279             set -o pipefail
280
281             # log info to console
282             echo "Uploading the Apex artifact. This could take some time..."
283             echo "--------------------------------------------------------"
284             echo
285
286             # source the opnfv.properties to get ARTIFACT_VERSION
287             source $WORKSPACE/opnfv.properties
288
289             # upload artifact and additional files to google storage
290             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
291             gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
292             gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
293             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
294             gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
295
296             echo
297             echo "--------------------------------------------------------"
298             echo "Done!"
299             echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
300             echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
301
302
303 #######################
304 # trigger macros
305 ########################
306 - trigger:
307     name: 'apex-master'
308     triggers:
309         - timed: '0 3 * * *'