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}'
247 default: ssh://gerrit.opnfv.org:29418/$PROJECT
248 description: "Used for overriding the GIT URL coming from parameters macro."
252 credentials-id: '{ssh-credentials}'
259 ########################
261 ########################
263 name: foreman-parameter
267 default: '{installer}'
268 description: "Installer to use."
270 name: BUILD_DIRECTORY
271 default: $WORKSPACE/build_output
272 description: "Directory where the build artifact will be located upon the completion of the build."
274 name: CACHE_DIRECTORY
275 default: $HOME/opnfv/cache/genesis-$INSTALLER
276 description: "Directory where the cache to be used during the build is located."
279 default: https://gerrit.opnfv.org/gerrit/$PROJECT
280 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
283 default: artifacts.opnfv.org/$PROJECT/$INSTALLER
284 description: "URL to Google Storage."
286 ########################
288 ########################
290 name: 'foreman-build'
298 # log info to console
299 echo "Starting the build of $INSTALLER. This could take some time..."
300 echo "--------------------------------------------------------"
303 # create the cache directory if it doesn't exist
304 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
306 # set OPNFV_ARTIFACT_VERSION
307 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
310 cd $WORKSPACE/$INSTALLER/ci
311 ./build.sh -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
313 # list the contents of BUILD_OUTPUT directory
314 ls -al $BUILD_DIRECTORY
316 # save information regarding artifact into file
318 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
319 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
320 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
321 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
322 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
323 echo "OPNFV_BUILD_URL=$BUILD_URL"
324 ) > $WORKSPACE/opnfv.properties
327 echo "--------------------------------------------------------"
331 name: 'foreman-deploy'
339 # log info to console
340 echo "Starting the deployment using $INSTALLER. This could take some time..."
341 echo "--------------------------------------------------------"
345 sudo $WORKSPACE/$INSTALLER/ci/clean.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
347 # and then initiate deployment
348 sudo $WORKSPACE/$INSTALLER/ci/deploy.sh -base_config $WORKSPACE/$INSTALLER/ci/inventory/lf_pod2_ksgen_settings.yml
351 echo "--------------------------------------------------------"
355 name: 'foreman-upload-artifact'
363 # log info to console
364 echo "Uploading the $INSTALLER artifact. This could take some time..."
365 echo "--------------------------------------------------------"
368 # source the opnfv.properties to get ARTIFACT_VERSION
369 source $WORKSPACE/opnfv.properties
371 # upload artifact and additional files to google storage
372 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
373 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
374 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
377 echo "--------------------------------------------------------"
381 name: 'foreman-workspace-cleanup'
389 # delete everything that is in $WORKSPACE
390 /bin/rm -rf $WORKSPACE