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
177 - 'apex-deploy-virtual'
178 - 'apex-upload-artifact'
179 - 'apex-workspace-cleanup'
182 name: 'apex-deploy-virtual-{stream}'
184 # Job template for virtual deployment
186 # Required Variables:
187 # stream: branch with - in place of / (eg. stable)
188 # branch: branch (eg. stable)
195 credentials-id: '{ssh-credentials}'
203 gs-pathname: '{gs-pathname}'
207 use-build-blocker: true
215 - 'apex-deploy-virtual'
216 - 'apex-workspace-cleanup'
219 name: 'apex-deploy-baremetal-{stream}'
221 # Job template for baremetal deployment
223 # Required Variables:
224 # stream: branch with - in place of / (eg. stable)
225 # branch: branch (eg. stable)
232 credentials-id: '{ssh-credentials}'
240 gs-pathname: '{gs-pathname}'
244 use-build-blocker: true
252 - 'apex-deploy-baremetal'
253 - 'apex-workspace-cleanup'
256 name: 'apex-daily-{stream}'
258 # Job template for daily build
260 # Required Variables:
261 # stream: branch with - in place of / (eg. stable)
262 # branch: branch (eg. stable)
269 credentials-id: '{ssh-credentials}'
277 gs-pathname: '{gs-pathname}'
281 use-build-blocker: true
292 - project: 'apex-build-{stream}'
296 - project: 'apex-deploy-virtual-{stream}'
300 - project: 'functest-apex-opnfv-jump-1-daily-{stream}'
303 build-step-failure-threshold: 'never'
304 failure-threshold: 'never'
305 unstable-threshold: 'FAILURE'
307 ########################
309 ########################
316 description: "RPM Artifact name that will be appended to GS_URL to deploy a specific artifact"
318 name: BUILD_DIRECTORY
319 default: $WORKSPACE/build_output
320 description: "Directory where the build artifact will be located upon the completion of the build."
322 name: CACHE_DIRECTORY
323 default: $HOME/opnfv/cache/{gs-pathname}
324 description: "Directory where the cache to be used during the build is located."
327 default: https://gerrit.opnfv.org/gerrit/$PROJECT
328 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
331 default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
332 description: "URL to Google Storage."
334 ########################
336 ########################
345 # log info to console
346 echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
347 echo "---------------------------------------------------------------------------------------"
349 # create the cache directory if it doesn't exist
350 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
351 # set OPNFV_ARTIFACT_VERSION
352 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
355 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
356 RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
357 # list the contents of BUILD_OUTPUT directory
358 ls -al $BUILD_DIRECTORY
359 # save information regarding artifact into file
361 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
362 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
363 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
364 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
365 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
366 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
367 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
368 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
369 echo "OPNFV_BUILD_URL=$BUILD_URL"
370 ) > $WORKSPACE/opnfv.properties
372 echo "--------------------------------------------------------"
375 name: 'apex-workspace-cleanup'
383 # delete everything that is in $WORKSPACE
384 /bin/rm -rf $WORKSPACE
387 name: 'apex-upload-artifact'
395 # log info to console
396 echo "Uploading the Apex artifact. This could take some time..."
397 echo "--------------------------------------------------------"
400 # source the opnfv.properties to get ARTIFACT_VERSION
401 source $WORKSPACE/opnfv.properties
403 # upload artifact and additional files to google storage
404 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
405 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
406 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
407 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
408 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
411 echo "--------------------------------------------------------"
413 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
414 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
417 name: 'apex-deploy-virtual'
425 # log info to console
426 echo "Starting the Apex virtual deployment."
427 echo "--------------------------------------------------------"
430 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
431 # if artifact name is passed the pull a
432 # specific artifact from artifacts.opnfv.org
433 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
435 if [[ -f opnfv.properties ]]; then
436 # if opnfv.properties exists then use the
437 # local build. Source the file so we get local OPNFV vars
438 source opnfv.properties
439 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
441 # no opnfv.properties means use the latest from artifacts.opnfv.org
442 # get the latest.properties to get the link to the latest artifact
443 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
444 [[ -f opnfv.properties ]] || exit 1
445 # source the file so we get OPNFV vars
446 source opnfv.properties
447 RPM_INSTALL_PATH=$OPNFV_RPM_URL
451 source opnfv.properties
452 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
454 # update / install the new rpm
455 if rpm -q opnfv-apex > /dev/null; then
456 if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
457 sudo yum downgrade -y $RPM_INSTALL_PATH;
460 sudo yum install -y $RPM_INSTALL_PATH;
463 # cleanup virtual machines before we start
465 # initiate virtual deployment
466 if [ -e /usr/share/doc/opnfv/network_settings.yaml.example ]; then
467 sudo opnfv-deploy -v -d /usr/share/doc/opnfv/deploy_settings.yaml.example -n /usr/share/doc/opnfv/network_settings.yaml.example
472 echo "--------------------------------------------------------"
476 name: 'apex-deploy-baremetal'
484 # log info to console
485 echo "Starting the Apex baremetal deployment."
486 echo "--------------------------------------------------------"
489 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
490 # if artifact name is passed the pull a
491 # specific artifact from artifacts.opnfv.org
492 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
494 if [[ -f opnfv.properties ]]; then
495 # if opnfv.properties exists then use the
496 # local build. Source the file so we get local OPNFV vars
497 source opnfv.properties
498 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
500 # no opnfv.properties means use the latest from artifacts.opnfv.org
501 # get the latest.properties to get the link to the latest artifact
502 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
503 [[ -f opnfv.properties ]] || exit 1
504 # source the file so we get OPNFV vars
505 source opnfv.properties
506 RPM_INSTALL_PATH=$OPNFV_RPM_URL
510 source opnfv.properties
511 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
512 if [ ! -e "$RPM_INSTALL_PATH" ]; then
513 RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
516 # update / install the new rpm
517 if rpm -q opnfv-apex > /dev/null; then
518 if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
519 echo "RPM is already installed"
520 elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
521 sudo yum downgrade -y $RPM_INSTALL_PATH;
524 sudo yum install -y $RPM_INSTALL_PATH;
527 # cleanup environment before we start
529 # initiate baremetal deployment
530 sudo opnfv-deploy -i /root/inventory/pod_settings.yaml \
531 -d /usr/share/doc/opnfv/deploy_settings.yaml.example \
532 -n /root/network/network_settings.yaml
535 echo "--------------------------------------------------------"
538 #######################
540 ########################