1 ########################
2 # Job configuration for genesis/fuel
3 ########################
13 - 'genesis-fuel-verify'
14 - 'genesis-fuel-merge'
15 - 'genesis-fuel-daily-{stream}'
16 - 'genesis-fuel-build'
17 - 'genesis-fuel-deploy'
23 ########################
25 ########################
28 name: 'genesis-fuel-verify'
30 project-type: freestyle
44 artifactDaysToKeep: -1
53 installer: '{installer}'
57 credentials-id: '{ssh-credentials}'
58 refspec: '$GERRIT_REFSPEC'
59 choosing-strategy: 'gerrit'
62 - ssh-agent-credentials:
63 user: '{ssh-credentials}'
68 - patchset-created-event:
69 exclude-drafts: 'false'
70 exclude-trivial-rebase: 'false'
71 exclude-no-code-change: 'false'
72 - draft-published-event
73 - comment-added-contains-event:
74 comment-contains-value: 'recheck'
75 - comment-added-contains-event:
76 comment-contains-value: 'reverify'
78 - project-compare-type: 'ANT'
79 project-pattern: 'genesis'
81 - branch-compare-type: 'ANT'
82 branch-pattern: '**/master'
87 pattern: '{installer}/**'
91 - 'fuel-workspace-cleanup'
94 name: 'genesis-fuel-merge'
96 project-type: freestyle
110 artifactDaysToKeep: -1
119 installer: '{installer}'
122 - gerrit-trigger-scm:
123 credentials-id: '{ssh-credentials}'
125 choosing-strategy: 'default'
128 - ssh-agent-credentials:
129 user: '{ssh-credentials}'
134 - change-merged-event
135 - comment-added-contains-event:
136 comment-contains-value: 'remerge'
138 - project-compare-type: 'ANT'
139 project-pattern: 'genesis'
141 - branch-compare-type: 'ANT'
142 branch-pattern: '**/master'
147 pattern: '{installer}/**'
151 - 'fuel-workspace-cleanup'
154 name: 'genesis-fuel-daily-{stream}'
156 project-type: freestyle
166 installer: '{installer}'
170 credentials-id: '{ssh-credentials}'
180 artifactDaysToKeep: -1
181 artifactNumToKeep: -1
185 - project: 'genesis-fuel-build'
189 - project: 'genesis-fuel-deploy-virtual'
194 name: 'genesis-fuel-build'
196 project-type: freestyle
203 artifactDaysToKeep: -1
204 artifactNumToKeep: -1
210 installer: '{installer}'
214 credentials-id: '{ssh-credentials}'
220 - 'fuel-upload-artifact'
221 - 'fuel-workspace-cleanup'
224 name: 'genesis-fuel-deploy'
226 project-type: freestyle
236 installer: '{installer}'
240 credentials-id: '{ssh-credentials}'
245 name: 'genesis-fuel-deploy-virtual'
247 project-type: freestyle
257 installer: '{installer}'
261 credentials-id: '{ssh-credentials}'
268 artifactDaysToKeep: -1
269 artifactNumToKeep: -1
272 - 'fuel-download-artifact'
273 - 'fuel-deploy-virtual'
275 ########################
277 ########################
283 default: '{installer}'
284 description: "Installer to use."
286 name: BUILD_DIRECTORY
287 default: $WORKSPACE/build_output
288 description: "Directory where the build artifact will be located upon the completion of the build."
290 name: CACHE_DIRECTORY
291 default: $HOME/opnfv/cache/genesis-$INSTALLER
292 description: "Directory where the cache to be used during the build is located."
295 default: https://gerrit.opnfv.org/gerrit/$PROJECT
296 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
299 default: artifacts.opnfv.org/$PROJECT/$INSTALLER
300 description: "URL to Google Storage."
302 ########################
304 ########################
314 # log info to console
315 echo "Starting the build of $INSTALLER. This could take some time..."
316 echo "--------------------------------------------------------"
319 # create the cache directory if it doesn't exist
320 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
322 # set OPNFV_ARTIFACT_VERSION
323 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
326 cd $WORKSPACE/$INSTALLER/ci
327 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
329 # list the build artifacts
330 ls -al $BUILD_DIRECTORY
332 # list the contents of BUILD_OUTPUT directory
333 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-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
342 echo "OPNFV_BUILD_URL=$BUILD_URL"
343 ) > $WORKSPACE/opnfv.properties
346 echo "--------------------------------------------------------"
358 # source the file so we get OPNFV vars
359 source latest.properties
361 # echo the info about artifact that is used during the deployment
362 echo "Using $(echo $OPNFV_ARTIFACT_URL | cut -d'/' -f4) for deployment"
365 export TOPDIR=$WORKSPACE/fuel/prototypes/auto-deploy
367 # log info to console
368 echo "Startint the deployment using $INSTALLER. This could take some time..."
369 echo "--------------------------------------------------------"
372 # start the deployment
373 echo "sudo ${TOPDIR}/deploy/deploy.sh $WORKSPACE/opnfv.iso ${TOPDIR}/configs/lf_pod1/dea.yaml ${TOPDIR}/configs/lf_pod1/dha.yaml"
376 echo "--------------------------------------------------------"
380 name: 'fuel-deploy-virtual'
388 # log info to console
389 echo "Startint the deployment on VM using $INSTALLER. This could take some time..."
390 echo "--------------------------------------------------------"
393 ssh -o BatchMode=yes -o TCPKeepAlive=yes cideploy@10.118.34.205 ./cideploy.sh
396 echo "--------------------------------------------------------"
400 name: 'fuel-upload-artifact'
408 # log info to console
409 echo "Uploading the $INSTALLER artifact. This could take some time..."
410 echo "--------------------------------------------------------"
413 # source the opnfv.properties to get ARTIFACT_VERSION
414 source $WORKSPACE/opnfv.properties
416 # upload artifact and additional files to google storage
417 gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
418 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
419 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
422 echo "--------------------------------------------------------"
426 name: 'fuel-download-artifact'
434 # log info to console
435 echo "Downloading the $INSTALLER artifact. This could take some time..."
436 echo "--------------------------------------------------------"
439 # get the latest.properties file in order to get info regarding latest artifact
440 gsutil cp gs://$GS_URL/latest.properties $WORKSPACE/latest.properties
442 # check if we got the file
443 [[ -f latest.properties ]] || exit 1
445 # source the file so we get OPNFV vars
446 source latest.properties
449 gsutil cp gs://$OPNFV_ARTIFACT_URL $WORKSPACE/opnfv.iso
452 ls -al $WORKSPACE/opnfv.iso
455 echo "--------------------------------------------------------"
459 name: 'fuel-workspace-cleanup'
467 # delete everything that is in $WORKSPACE
468 /bin/rm -rf $WORKSPACE