1 ########################
2 # Job configuration for genesis/foreman
3 ########################
13 - 'genesis-foreman-verify'
14 - 'genesis-foreman-merge'
15 - 'genesis-foreman-daily-{stream}'
16 - 'genesis-foreman-build'
17 - 'genesis-foreman-deploy'
23 ########################
25 ########################
28 name: 'genesis-foreman-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 - 'foreman-workspace-cleanup'
94 name: 'genesis-foreman-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 - 'foreman-workspace-cleanup'
154 name: 'genesis-foreman-daily-{stream}'
156 project-type: freestyle
166 installer: '{installer}'
170 credentials-id: '{ssh-credentials}'
175 - timed: 'H */6 * * *'
180 artifactDaysToKeep: -1
181 artifactNumToKeep: -1
185 - project: 'genesis-foreman-build'
189 - project: 'genesis-foreman-deploy'
193 - project: 'functest-opnfv-jump-2'
197 name: 'genesis-foreman-build'
199 project-type: freestyle
206 artifactDaysToKeep: -1
207 artifactNumToKeep: -1
213 installer: '{installer}'
217 credentials-id: '{ssh-credentials}'
223 - 'foreman-upload-artifact'
226 name: 'genesis-foreman-deploy'
228 project-type: freestyle
237 artifactDaysToKeep: -1
238 artifactNumToKeep: -1
244 installer: '{installer}'
248 credentials-id: '{ssh-credentials}'
255 ########################
257 ########################
259 name: foreman-parameter
263 default: '{installer}'
264 description: "Installer to use."
266 name: BUILD_DIRECTORY
267 default: $WORKSPACE/build_output
268 description: "Directory where the build artifact will be located upon the completion of the build."
270 name: CACHE_DIRECTORY
271 default: $HOME/opnfv/cache/genesis-$INSTALLER
272 description: "Directory where the cache to be used during the build is located."
275 default: https://gerrit.opnfv.org/gerrit/$PROJECT
276 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
279 default: artifacts.opnfv.org/$PROJECT/$INSTALLER
280 description: "URL to Google Storage."
282 ########################
284 ########################
286 name: 'foreman-build'
294 # log info to console
295 echo "Starting the build of $INSTALLER. This could take some time..."
296 echo "--------------------------------------------------------"
299 # create the cache directory if it doesn't exist
300 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
302 # set OPNFV_ARTIFACT_VERSION
303 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
306 cd $WORKSPACE/$INSTALLER/ci
307 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
309 # list the contents of BUILD_OUTPUT directory
310 ls -al $BUILD_DIRECTORY
312 # save information regarding artifact into file
314 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
315 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
316 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
317 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
318 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
319 echo "OPNFV_BUILD_URL=$BUILD_URL"
320 ) > $WORKSPACE/opnfv.properties
323 echo "--------------------------------------------------------"
327 name: 'foreman-deploy'
335 # log info to console
336 echo "Starting the deployment using $INSTALLER. This could take some time..."
337 echo "--------------------------------------------------------"
341 sudo $WORKSPACE/$INSTALLER/ci/clean.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
343 # and then initiate deployment
344 sudo $WORKSPACE/$INSTALLER/ci/deploy.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
347 echo "--------------------------------------------------------"
351 name: 'foreman-upload-artifact'
359 # log info to console
360 echo "Uploading the $INSTALLER artifact. This could take some time..."
361 echo "--------------------------------------------------------"
364 # source the opnfv.properties to get ARTIFACT_VERSION
365 source $WORKSPACE/opnfv.properties
367 # upload artifact and additional files to google storage
368 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
369 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
370 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
373 echo "--------------------------------------------------------"
377 name: 'foreman-workspace-cleanup'
385 # delete everything that is in $WORKSPACE
386 /bin/rm -rf $WORKSPACE