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 - project: 'yardstick-apex-opnfv-jump-1-daily-{stream}'
307 build-step-failure-threshold: 'never'
308 failure-threshold: 'never'
309 unstable-threshold: 'FAILURE'
311 ########################
313 ########################
320 description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
322 name: BUILD_DIRECTORY
323 default: $WORKSPACE/build_output
324 description: "Directory where the build artifact will be located upon the completion of the build."
326 name: CACHE_DIRECTORY
327 default: $HOME/opnfv/cache/{gs-pathname}
328 description: "Directory where the cache to be used during the build is located."
331 default: https://gerrit.opnfv.org/gerrit/$PROJECT
332 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
335 default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
336 description: "URL to Google Storage."
338 ########################
340 ########################
349 # log info to console
350 echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
351 echo "---------------------------------------------------------------------------------------"
353 # create the cache directory if it doesn't exist
354 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
355 # set OPNFV_ARTIFACT_VERSION
356 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
359 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
360 RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
361 # list the contents of BUILD_OUTPUT directory
362 ls -al $BUILD_DIRECTORY
363 # save information regarding artifact into file
365 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
366 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
367 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
368 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
369 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
370 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
371 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
372 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
373 echo "OPNFV_BUILD_URL=$BUILD_URL"
374 ) > $WORKSPACE/opnfv.properties
376 echo "--------------------------------------------------------"
379 name: 'apex-workspace-cleanup'
387 # delete everything that is in $WORKSPACE
388 /bin/rm -rf $WORKSPACE
391 name: 'apex-upload-artifact'
399 # log info to console
400 echo "Uploading the Apex artifact. This could take some time..."
401 echo "--------------------------------------------------------"
404 # source the opnfv.properties to get ARTIFACT_VERSION
405 source $WORKSPACE/opnfv.properties
407 # upload artifact and additional files to google storage
408 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
409 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
410 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
411 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
412 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
415 echo "--------------------------------------------------------"
417 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
418 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
421 name: 'apex-deploy-virtual'
429 # log info to console
430 echo "Starting the Apex virtual deployment."
431 echo "--------------------------------------------------------"
434 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
435 # if artifact name is passed the pull a
436 # specific artifact from artifacts.opnfv.org
437 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
439 if [[ -f opnfv.properties ]]; then
440 # if opnfv.properties exists then use the
441 # local build. Source the file so we get local OPNFV vars
442 source opnfv.properties
443 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
445 # no opnfv.properties means use the latest from artifacts.opnfv.org
446 # get the latest.properties to get the link to the latest artifact
447 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
448 [[ -f opnfv.properties ]] || exit 1
449 # source the file so we get OPNFV vars
450 source opnfv.properties
451 RPM_INSTALL_PATH=$OPNFV_RPM_URL
455 source opnfv.properties
456 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
458 # update / install the new rpm
459 if rpm -q opnfv-apex > /dev/null; then
460 if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
461 sudo yum downgrade -y $RPM_INSTALL_PATH;
464 sudo yum install -y $RPM_INSTALL_PATH;
467 # cleanup virtual machines before we start
469 # initiate virtual deployment
470 if [ -e /usr/share/doc/opnfv/network_settings.yaml.example ]; then
471 sudo opnfv-deploy -v -d /usr/share/doc/opnfv/deploy_settings.yaml.example -n /usr/share/doc/opnfv/network_settings.yaml.example
476 echo "--------------------------------------------------------"
480 name: 'apex-deploy-baremetal'
488 # log info to console
489 echo "Starting the Apex baremetal deployment."
490 echo "--------------------------------------------------------"
493 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
494 # if artifact name is passed the pull a
495 # specific artifact from artifacts.opnfv.org
496 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
498 if [[ -f opnfv.properties ]]; then
499 # if opnfv.properties exists then use the
500 # local build. Source the file so we get local OPNFV vars
501 source opnfv.properties
502 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
504 # no opnfv.properties means use the latest from artifacts.opnfv.org
505 # get the latest.properties to get the link to the latest artifact
506 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
507 [[ -f opnfv.properties ]] || exit 1
508 # source the file so we get OPNFV vars
509 source opnfv.properties
510 RPM_INSTALL_PATH=$OPNFV_RPM_URL
514 source opnfv.properties
515 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
516 if [ ! -e "$RPM_INSTALL_PATH" ]; then
517 RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
520 # update / install the new rpm
521 if rpm -q opnfv-apex > /dev/null; then
522 if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
523 echo "RPM is already installed"
524 elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
525 sudo yum downgrade -y $RPM_INSTALL_PATH;
528 sudo yum install -y $RPM_INSTALL_PATH;
531 # cleanup environment before we start
533 # initiate baremetal deployment
534 sudo opnfv-deploy -i /root/inventory/pod_settings.yaml \
535 -d /usr/share/doc/opnfv/deploy_settings.yaml.example \
536 -n /root/network/network_settings.yaml
539 echo "--------------------------------------------------------"
542 #######################
544 ########################