4 - 'apex-verify-{stream}'
5 - 'apex-merge-{stream}'
6 - 'apex-build-{stream}'
7 - 'apex-deploy-virtual-{stream}'
8 - 'apex-deploy-baremetal-{stream}'
9 - 'apex-daily-{stream}'
11 # stream: branch with - in place of / (eg. stable-arno)
12 # branch: branch (eg. stable/arno)
23 name: 'apex-verify-{stream}'
29 gs-pathname: '{gs-pathname}'
37 default: ssh://gerrit.opnfv.org:29418/$PROJECT
38 description: "Used for overriding the GIT URL coming from parameters macro."
42 credentials-id: '{ssh-credentials}'
43 refspec: '$GERRIT_REFSPEC'
44 choosing-strategy: 'gerrit'
49 - patchset-created-event:
50 exclude-drafts: 'false'
51 exclude-trivial-rebase: 'false'
52 exclude-no-code-change: 'false'
53 - draft-published-event
54 - comment-added-contains-event:
55 comment-contains-value: 'recheck'
56 - comment-added-contains-event:
57 comment-contains-value: 'reverify'
59 - project-compare-type: 'ANT'
60 project-pattern: 'apex'
62 - branch-compare-type: 'ANT'
63 branch-pattern: '**/master'
70 use-build-blocker: true
76 - 'apex-deploy-virtual'
77 - 'apex-workspace-cleanup'
80 name: 'apex-merge-{stream}'
82 # builder-merge job to run JJB update
84 # This job's purpose is to update all the JJB
92 gs-pathname: '{gs-pathname}'
100 default: ssh://gerrit.opnfv.org:29418/$PROJECT
101 description: "Used for overriding the GIT URL coming from parameters macro."
104 - gerrit-trigger-scm:
105 credentials-id: '{ssh-credentials}'
107 choosing-strategy: 'default'
112 - change-merged-event
113 - comment-added-contains-event:
114 comment-contains-value: 'remerge'
116 - project-compare-type: 'ANT'
117 project-pattern: 'apex'
119 - branch-compare-type: 'ANT'
120 branch-pattern: '**/master'
121 forbidden-file-paths:
127 - 'apex-deploy-virtual'
128 - 'apex-workspace-cleanup'
131 name: 'apex-build-{stream}'
133 # Job template for builds
135 # Required Variables:
136 # stream: branch with - in place of / (eg. stable)
137 # branch: branch (eg. stable)
146 gs-pathname: '{gs-pathname}'
152 default: ssh://gerrit.opnfv.org:29418/$PROJECT
153 description: "Used for overriding the GIT URL coming from parameters macro."
157 credentials-id: '{ssh-credentials}'
163 - 'apex-deploy-virtual'
164 - 'apex-upload-artifact'
165 - 'apex-workspace-cleanup'
168 name: 'apex-deploy-virtual-{stream}'
170 # Job template for virtual deployment
172 # Required Variables:
173 # stream: branch with - in place of / (eg. stable)
174 # branch: branch (eg. stable)
181 credentials-id: '{ssh-credentials}'
189 gs-pathname: '{gs-pathname}'
193 - 'apex-deploy-virtual'
194 - 'apex-workspace-cleanup'
197 name: 'apex-deploy-baremetal-{stream}'
199 # Job template for baremetal deployment
201 # Required Variables:
202 # stream: branch with - in place of / (eg. stable)
203 # branch: branch (eg. stable)
210 credentials-id: '{ssh-credentials}'
218 gs-pathname: '{gs-pathname}'
222 - 'apex-workspace-cleanup'
225 name: 'apex-daily-{stream}'
227 # Job template for daily build
229 # Required Variables:
230 # stream: branch with - in place of / (eg. stable)
231 # branch: branch (eg. stable)
238 credentials-id: '{ssh-credentials}'
246 gs-pathname: '{gs-pathname}'
251 use-build-blocker: true
260 - project: 'apex-build-{stream}'
264 - project: 'apex-deploy-virtual-{stream}'
268 - project: 'apex-deploy-baremetal-{stream}'
270 - project: 'functest-apex-{stream}'
273 build-step-failure-threshold: 'never'
274 failure-threshold: 'never'
275 unstable-threshold: 'FAILURE'
277 ########################
279 ########################
286 description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
288 name: BUILD_DIRECTORY
289 default: $WORKSPACE/build_output
290 description: "Directory where the build artifact will be located upon the completion of the build."
292 name: CACHE_DIRECTORY
293 default: $HOME/opnfv/cache/{gs-pathname}
294 description: "Directory where the cache to be used during the build is located."
297 default: https://gerrit.opnfv.org/gerrit/$PROJECT
298 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
301 default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
302 description: "URL to Google Storage."
306 description: "Build Flags"
308 ########################
310 ########################
319 # log info to console
320 echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
321 echo "---------------------------------------------------------------------------------------"
322 echo "Build flags for this build are ${FLAGS}"
323 echo "---------------------------------------------------------------------------------------"
325 # create the cache directory if it doesn't exist
326 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
327 # set OPNFV_ARTIFACT_VERSION
328 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
331 ./build.sh $FLAGS -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
332 RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
333 # list the contents of BUILD_OUTPUT directory
334 ls -al $BUILD_DIRECTORY
335 # save information regarding artifact into file
337 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
338 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
339 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
340 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
341 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
342 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
343 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
344 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
345 echo "OPNFV_BUILD_URL=$BUILD_URL"
346 ) > $WORKSPACE/opnfv.properties
348 echo "--------------------------------------------------------"
351 name: 'apex-workspace-cleanup'
359 # delete everything that is in $WORKSPACE
360 /bin/rm -rf $WORKSPACE
363 name: 'apex-upload-artifact'
371 # log info to console
372 echo "Uploading the Apex artifact. This could take some time..."
373 echo "--------------------------------------------------------"
376 # source the opnfv.properties to get ARTIFACT_VERSION
377 source $WORKSPACE/opnfv.properties
379 # upload artifact and additional files to google storage
380 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
381 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
382 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
383 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
384 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
387 echo "--------------------------------------------------------"
389 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
390 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
393 name: 'apex-deploy-virtual'
401 # log info to console
402 echo "Starting the Apex virtual deployment."
403 echo "--------------------------------------------------------"
406 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
407 # if artifact name is passed the pull a
408 # specific artifact from artifacts.opnfv.org
409 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
411 if [[ -f opnfv.properties ]]; then
412 # if opnfv.properties exists then use the
413 # local build. Source the file so we get local OPNFV vars
414 source opnfv.properties
415 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
417 # no opnfv.properties means use the latest from artifacts.opnfv.org
418 # get the latest.properties to get the link to the latest artifact
419 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
420 [[ -f opnfv.properties ]] || exit 1
421 # source the file so we get OPNFV vars
422 source opnfv.properties
423 RPM_INSTALL_PATH=$OPNFV_RPM_URL
427 source opnfv.properties
428 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
430 # update / install the new rpm
431 if rpm -q opnfv-apex > /dev/null; then
432 if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
433 sudo yum downgrade -y $RPM_INSTALL_PATH;
436 sudo yum install -y $RPM_INSTALL_PATH;
439 # cleanup virtual machines before we start
441 # initiate virtual deployment
445 echo "--------------------------------------------------------"
448 #######################
450 ########################