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
82 - 'apex-deploy-virtual'
83 - 'apex-workspace-cleanup'
86 name: 'apex-merge-{stream}'
88 # builder-merge job to run JJB update
90 # This job's purpose is to update all the JJB
98 gs-pathname: '{gs-pathname}'
105 default: https://gerrit.opnfv.org/gerrit/$PROJECT
106 description: "Used for overriding the GIT URL coming from parameters macro."
109 - gerrit-trigger-scm:
110 credentials-id: '{ssh-credentials}'
112 choosing-strategy: 'default'
117 - change-merged-event
118 - comment-added-contains-event:
119 comment-contains-value: 'remerge'
121 - project-compare-type: 'ANT'
122 project-pattern: 'apex'
124 - branch-compare-type: 'ANT'
125 branch-pattern: '**/master'
126 forbidden-file-paths:
132 - 'apex-deploy-virtual'
133 - 'apex-workspace-cleanup'
136 name: 'apex-build-{stream}'
138 # Job template for builds
140 # Required Variables:
141 # stream: branch with - in place of / (eg. stable)
142 # branch: branch (eg. stable)
151 gs-pathname: '{gs-pathname}'
156 default: https://gerrit.opnfv.org/gerrit/$PROJECT
157 description: "Used for overriding the GIT URL coming from parameters macro."
161 credentials-id: '{ssh-credentials}'
167 - 'apex-deploy-virtual'
168 - 'apex-upload-artifact'
169 - 'apex-workspace-cleanup'
172 name: 'apex-deploy-virtual-{stream}'
174 # Job template for virtual deployment
176 # Required Variables:
177 # stream: branch with - in place of / (eg. stable)
178 # branch: branch (eg. stable)
185 credentials-id: '{ssh-credentials}'
193 gs-pathname: '{gs-pathname}'
196 - 'apex-deploy-virtual'
197 - 'apex-workspace-cleanup'
200 name: 'apex-deploy-baremetal-{stream}'
202 # Job template for baremetal deployment
204 # Required Variables:
205 # stream: branch with - in place of / (eg. stable)
206 # branch: branch (eg. stable)
213 credentials-id: '{ssh-credentials}'
221 gs-pathname: '{gs-pathname}'
224 - 'apex-deploy-baremetal'
225 - 'apex-workspace-cleanup'
228 name: 'apex-daily-{stream}'
230 # Job template for daily build
232 # Required Variables:
233 # stream: branch with - in place of / (eg. stable)
234 # branch: branch (eg. stable)
241 credentials-id: '{ssh-credentials}'
249 gs-pathname: '{gs-pathname}'
253 use-build-blocker: true
262 - project: 'apex-build-{stream}'
266 - project: 'apex-deploy-baremetal-{stream}'
270 - project: 'functest-apex-opnfv-jump-1-daily-{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."
304 ########################
306 ########################
315 # log info to console
316 echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
317 echo "---------------------------------------------------------------------------------------"
319 # create the cache directory if it doesn't exist
320 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
321 # set OPNFV_ARTIFACT_VERSION
322 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
325 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
326 RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
327 # list the contents of BUILD_OUTPUT directory
328 ls -al $BUILD_DIRECTORY
329 # save information regarding artifact into file
331 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
332 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
333 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
334 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
335 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
336 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
337 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
338 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
339 echo "OPNFV_BUILD_URL=$BUILD_URL"
340 ) > $WORKSPACE/opnfv.properties
342 echo "--------------------------------------------------------"
345 name: 'apex-workspace-cleanup'
353 # delete everything that is in $WORKSPACE
354 /bin/rm -rf $WORKSPACE
357 name: 'apex-upload-artifact'
365 # log info to console
366 echo "Uploading the Apex artifact. This could take some time..."
367 echo "--------------------------------------------------------"
370 # source the opnfv.properties to get ARTIFACT_VERSION
371 source $WORKSPACE/opnfv.properties
373 # upload artifact and additional files to google storage
374 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
375 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
376 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
377 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
378 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
381 echo "--------------------------------------------------------"
383 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
384 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
387 name: 'apex-deploy-virtual'
395 # log info to console
396 echo "Starting the Apex virtual deployment."
397 echo "--------------------------------------------------------"
400 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
401 # if artifact name is passed the pull a
402 # specific artifact from artifacts.opnfv.org
403 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
405 if [[ -f opnfv.properties ]]; then
406 # if opnfv.properties exists then use the
407 # local build. Source the file so we get local OPNFV vars
408 source opnfv.properties
409 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
411 # no opnfv.properties means use the latest from artifacts.opnfv.org
412 # get the latest.properties to get the link to the latest artifact
413 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
414 [[ -f opnfv.properties ]] || exit 1
415 # source the file so we get OPNFV vars
416 source opnfv.properties
417 RPM_INSTALL_PATH=$OPNFV_RPM_URL
421 source opnfv.properties
422 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
424 # update / install the new rpm
425 if rpm -q opnfv-apex > /dev/null; then
426 if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
427 sudo yum downgrade -y $RPM_INSTALL_PATH;
430 sudo yum install -y $RPM_INSTALL_PATH;
433 # cleanup virtual machines before we start
435 # initiate virtual deployment
436 if [ -e /usr/share/doc/opnfv/network_settings.yaml.example ]; then
437 sudo opnfv-deploy -v -d /usr/share/doc/opnfv/deploy_settings.yaml.example -n /usr/share/doc/opnfv/network_settings.yaml.example
442 echo "--------------------------------------------------------"
446 name: 'apex-deploy-baremetal'
454 # log info to console
455 echo "Starting the Apex baremetal deployment."
456 echo "--------------------------------------------------------"
459 if [[ ! "$ARTIFACT_NAME" == "latest" ]]; then
460 # if artifact name is passed the pull a
461 # specific artifact from artifacts.opnfv.org
462 RPM_INSTALL_PATH=$GS_URL/$ARTIFACT_NAME
464 if [[ -f opnfv.properties ]]; then
465 # if opnfv.properties exists then use the
466 # local build. Source the file so we get local OPNFV vars
467 source opnfv.properties
468 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
470 # no opnfv.properties means use the latest from artifacts.opnfv.org
471 # get the latest.properties to get the link to the latest artifact
472 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
473 [[ -f opnfv.properties ]] || exit 1
474 # source the file so we get OPNFV vars
475 source opnfv.properties
476 RPM_INSTALL_PATH=$OPNFV_RPM_URL
480 source opnfv.properties
481 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
482 if [ ! -e "$RPM_INSTALL_PATH" ]; then
483 RPM_INSTALL_PATH=http://${OPNFV_RPM_URL}
486 # update / install the new rpm
487 if rpm -q opnfv-apex > /dev/null; then
488 if [ $(basename $OPNFV_RPM_URL) == $(rpm -q opnfv-apex).rpm ]; then
489 echo "RPM is already installed"
490 elif sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
491 sudo yum downgrade -y $RPM_INSTALL_PATH;
494 sudo yum install -y $RPM_INSTALL_PATH;
497 # cleanup environment before we start
499 # initiate baremetal deployment
500 sudo opnfv-deploy -i /root/inventory/pod_settings.yaml \
501 -d /usr/share/doc/opnfv/deploy_settings.yaml.example \
502 -n /root/network/network_settings.yaml
505 echo "--------------------------------------------------------"
508 #######################
510 ########################