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}'
177 artifactDaysToKeep: -1
178 artifactNumToKeep: -1
182 - project: 'genesis-foreman-build'
186 - project: 'genesis-foreman-deploy'
190 - project: 'functest-opnfv-jump-2'
194 name: 'genesis-foreman-build'
196 project-type: freestyle
203 artifactDaysToKeep: -1
204 artifactNumToKeep: -1
210 installer: '{installer}'
214 credentials-id: '{ssh-credentials}'
220 - 'foreman-upload-artifact'
223 name: 'genesis-foreman-deploy'
225 project-type: freestyle
234 artifactDaysToKeep: -1
235 artifactNumToKeep: -1
241 installer: '{installer}'
244 default: ssh://gerrit.opnfv.org:29418/$PROJECT
245 description: "Used for overriding the GIT URL coming from parameters macro."
249 credentials-id: '{ssh-credentials}'
256 ########################
258 ########################
260 name: foreman-parameter
264 default: '{installer}'
265 description: "Installer to use."
267 name: BUILD_DIRECTORY
268 default: $WORKSPACE/build_output
269 description: "Directory where the build artifact will be located upon the completion of the build."
271 name: CACHE_DIRECTORY
272 default: $HOME/opnfv/cache/genesis-$INSTALLER
273 description: "Directory where the cache to be used during the build is located."
276 default: https://gerrit.opnfv.org/gerrit/$PROJECT
277 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
280 default: artifacts.opnfv.org/$PROJECT/$INSTALLER
281 description: "URL to Google Storage."
283 ########################
285 ########################
287 name: 'foreman-build'
295 # log info to console
296 echo "Starting the build of $INSTALLER. This could take some time..."
297 echo "--------------------------------------------------------"
300 # create the cache directory if it doesn't exist
301 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
303 # set OPNFV_ARTIFACT_VERSION
304 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
307 cd $WORKSPACE/$INSTALLER/ci
308 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
310 # list the contents of BUILD_OUTPUT directory
311 ls -al $BUILD_DIRECTORY
313 # save information regarding artifact into file
315 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
316 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
317 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
318 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
319 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
320 echo "OPNFV_BUILD_URL=$BUILD_URL"
321 ) > $WORKSPACE/opnfv.properties
324 echo "--------------------------------------------------------"
328 name: 'foreman-deploy'
336 # log info to console
337 echo "Starting the deployment using $INSTALLER. This could take some time..."
338 echo "--------------------------------------------------------"
342 sudo $WORKSPACE/$INSTALLER/ci/clean.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
344 # and then initiate deployment
345 sudo $WORKSPACE/$INSTALLER/ci/deploy.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
348 echo "--------------------------------------------------------"
352 name: 'foreman-upload-artifact'
360 # log info to console
361 echo "Uploading the $INSTALLER artifact. This could take some time..."
362 echo "--------------------------------------------------------"
365 # source the opnfv.properties to get ARTIFACT_VERSION
366 source $WORKSPACE/opnfv.properties
368 # upload artifact and additional files to google storage
369 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
370 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
371 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
374 echo "--------------------------------------------------------"
378 name: 'foreman-workspace-cleanup'
386 # delete everything that is in $WORKSPACE
387 /bin/rm -rf $WORKSPACE