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)
21 name: 'apex-verify-{stream}'
27 gs-pathname: '{gs-pathname}'
34 default: https://gerrit.opnfv.org/gerrit/$PROJECT
35 description: "Used for overriding the GIT URL coming from parameters macro."
39 credentials-id: '{ssh-credentials}'
40 refspec: '$GERRIT_REFSPEC'
41 choosing-strategy: 'gerrit'
46 - patchset-created-event:
47 exclude-drafts: 'false'
48 exclude-trivial-rebase: 'false'
49 exclude-no-code-change: 'false'
50 - draft-published-event
51 - comment-added-contains-event:
52 comment-contains-value: 'recheck'
53 - comment-added-contains-event:
54 comment-contains-value: 'reverify'
56 - project-compare-type: 'ANT'
57 project-pattern: 'apex'
59 - branch-compare-type: 'ANT'
60 branch-pattern: '**/master'
76 use-build-blocker: true
84 - 'apex-deploy-virtual'
85 - 'apex-workspace-cleanup'
88 name: 'apex-merge-{stream}'
90 # builder-merge job to run JJB update
92 # This job's purpose is to update all the JJB
100 gs-pathname: '{gs-pathname}'
107 default: https://gerrit.opnfv.org/gerrit/$PROJECT
108 description: "Used for overriding the GIT URL coming from parameters macro."
111 - gerrit-trigger-scm:
112 credentials-id: '{ssh-credentials}'
114 choosing-strategy: 'default'
119 - change-merged-event
120 - comment-added-contains-event:
121 comment-contains-value: 'remerge'
123 - project-compare-type: 'ANT'
124 project-pattern: 'apex'
126 - branch-compare-type: 'ANT'
127 branch-pattern: '**/master'
128 forbidden-file-paths:
134 - 'apex-deploy-virtual'
135 - 'apex-workspace-cleanup'
138 name: 'apex-build-{stream}'
140 # Job template for builds
142 # Required Variables:
143 # stream: branch with - in place of / (eg. stable)
144 # branch: branch (eg. stable)
153 gs-pathname: '{gs-pathname}'
158 default: https://gerrit.opnfv.org/gerrit/$PROJECT
159 description: "Used for overriding the GIT URL coming from parameters macro."
163 credentials-id: '{ssh-credentials}'
169 use-build-blocker: true
175 - 'apex-deploy-virtual'
176 - 'apex-upload-artifact'
177 - 'apex-workspace-cleanup'
180 name: 'apex-deploy-virtual-{stream}'
182 # Job template for virtual deployment
184 # Required Variables:
185 # stream: branch with - in place of / (eg. stable)
186 # branch: branch (eg. stable)
193 credentials-id: '{ssh-credentials}'
201 gs-pathname: '{gs-pathname}'
205 use-build-blocker: true
212 - 'apex-deploy-virtual'
213 - 'apex-workspace-cleanup'
216 name: 'apex-deploy-baremetal-{stream}'
218 # Job template for baremetal deployment
220 # Required Variables:
221 # stream: branch with - in place of / (eg. stable)
222 # branch: branch (eg. stable)
229 credentials-id: '{ssh-credentials}'
237 gs-pathname: '{gs-pathname}'
241 use-build-blocker: true
249 - 'apex-deploy-baremetal'
250 - 'apex-workspace-cleanup'
253 name: 'apex-daily-{stream}'
255 # Job template for daily build
257 # Required Variables:
258 # stream: branch with - in place of / (eg. stable)
259 # branch: branch (eg. stable)
266 credentials-id: '{ssh-credentials}'
274 gs-pathname: '{gs-pathname}'
278 use-build-blocker: true
289 - project: 'apex-build-{stream}'
293 - project: 'apex-deploy-virtual-{stream}'
297 - project: 'functest-apex-opnfv-jump-1-daily-{stream}'
300 build-step-failure-threshold: 'never'
301 failure-threshold: 'never'
302 unstable-threshold: 'FAILURE'
304 ########################
306 ########################
313 description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
315 name: BUILD_DIRECTORY
316 default: $WORKSPACE/build_output
317 description: "Directory where the build artifact will be located upon the completion of the build."
319 name: CACHE_DIRECTORY
320 default: $HOME/opnfv/cache/{gs-pathname}
321 description: "Directory where the cache to be used during the build is located."
324 default: https://gerrit.opnfv.org/gerrit/$PROJECT
325 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
328 default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
329 description: "URL to Google Storage."
331 ########################
333 ########################
342 # log info to console
343 echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
344 echo "---------------------------------------------------------------------------------------"
346 # create the cache directory if it doesn't exist
347 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
348 # set OPNFV_ARTIFACT_VERSION
349 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
352 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
353 RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
354 # list the contents of BUILD_OUTPUT directory
355 ls -al $BUILD_DIRECTORY
356 # save information regarding artifact into file
358 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
359 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
360 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
361 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
362 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
363 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
364 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
365 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
366 echo "OPNFV_BUILD_URL=$BUILD_URL"
367 ) > $WORKSPACE/opnfv.properties
369 echo "--------------------------------------------------------"
372 name: 'apex-workspace-cleanup'
380 # delete everything that is in $WORKSPACE
381 /bin/rm -rf $WORKSPACE
384 name: 'apex-upload-artifact'
392 # log info to console
393 echo "Uploading the Apex artifact. This could take some time..."
394 echo "--------------------------------------------------------"
397 # source the opnfv.properties to get ARTIFACT_VERSION
398 source $WORKSPACE/opnfv.properties
400 # upload artifact and additional files to google storage
401 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
402 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
403 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
404 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
405 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
408 echo "--------------------------------------------------------"
410 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
411 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
414 name: 'apex-deploy-virtual'
422 # log info to console
423 echo "Starting the Apex virtual deployment."
424 echo "--------------------------------------------------------"
427 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
428 # if artifact name is passed the pull a
429 # specific artifact from artifacts.opnfv.org
430 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
432 if [[ -f opnfv.properties ]]; then
433 # if opnfv.properties exists then use the
434 # local build. Source the file so we get local OPNFV vars
435 source opnfv.properties
436 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
438 # no opnfv.properties means use the latest from artifacts.opnfv.org
439 # get the latest.properties to get the link to the latest artifact
440 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
441 [[ -f opnfv.properties ]] || exit 1
442 # source the file so we get OPNFV vars
443 source opnfv.properties
444 RPM_INSTALL_PATH=$OPNFV_RPM_URL
448 source opnfv.properties
449 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
451 # update / install the new rpm
452 if rpm -q opnfv-apex > /dev/null; then
453 if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
454 sudo yum downgrade -y $RPM_INSTALL_PATH;
457 sudo yum install -y $RPM_INSTALL_PATH;
460 # cleanup virtual machines before we start
462 # initiate virtual deployment
463 if [ -e /usr/share/doc/opnfv/network_settings.yaml.example ]; then
464 sudo opnfv-deploy -v -d /usr/share/doc/opnfv/deploy_settings.yaml.example -n /usr/share/doc/opnfv/network_settings.yaml.example
469 echo "--------------------------------------------------------"
473 name: 'apex-deploy-baremetal'
481 # log info to console
482 echo "Starting the Apex baremetal deployment."
483 echo "--------------------------------------------------------"
486 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
487 # if artifact name is passed the pull a
488 # specific artifact from artifacts.opnfv.org
489 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
491 if [[ -f opnfv.properties ]]; then
492 # if opnfv.properties exists then use the
493 # local build. Source the file so we get local OPNFV vars
494 source opnfv.properties
495 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
497 # no opnfv.properties means use the latest from artifacts.opnfv.org
498 # get the latest.properties to get the link to the latest artifact
499 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
500 [[ -f opnfv.properties ]] || exit 1
501 # source the file so we get OPNFV vars
502 source opnfv.properties
503 RPM_INSTALL_PATH=$OPNFV_RPM_URL
507 source opnfv.properties
508 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
509 if [ ! -e "$RPM_INSTALL_PATH" ]; then
510 RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
513 # update / install the new rpm
514 if rpm -q opnfv-apex > /dev/null; then
515 if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
516 echo "RPM is already installed"
517 elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
518 sudo yum downgrade -y $RPM_INSTALL_PATH;
521 sudo yum install -y $RPM_INSTALL_PATH;
524 # cleanup environment before we start
526 # initiate baremetal deployment
527 sudo opnfv-deploy -i /root/inventory/pod_settings.yaml \
528 -d /usr/share/doc/opnfv/deploy_settings.yaml.example \
529 -n /root/network/network_settings.yaml
532 echo "--------------------------------------------------------"
535 #######################
537 ########################