| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | /* | 
					
						
							|  |  |  |  * This pipeline is the "template" for the Asterisk Gate Tests multi-branch | 
					
						
							|  |  |  |  * parent job.  Jenkins will automatically scan the branches in the "asterisk" | 
					
						
							|  |  |  |  * or "Security-asterisk" projects in Gerrit and automatically create a branch- | 
					
						
							|  |  |  |  * specific job for each branch it finds this file in. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This file starts as a declarative pipeline because with a declarative | 
					
						
							|  |  |  |  * pipeline, you can define the trigger in the pipeline file.  This keeps | 
					
						
							|  |  |  |  * everything in one place.  We transition to scripted pipeline later on because | 
					
						
							|  |  |  |  * we need to dynamically determine which docker image we're going to use and | 
					
						
							|  |  |  |  * you can't do that in a delcarative pipeline. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-11-19 10:59:07 -07:00
										 |  |  | def timeoutTime = 60 | 
					
						
							|  |  |  | def timeoutUnits = 'MINUTES' | 
					
						
							|  |  |  | if (env.TIMEOUT_GATES) { | 
					
						
							|  |  |  | 	def _timeout = env.TIMEOUT_GATES.split() | 
					
						
							|  |  |  | 	timeoutTime = _timeout[0].toInteger() | 
					
						
							|  |  |  | 	timeoutUnits = _timeout[1] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | pipeline { | 
					
						
							| 
									
										
										
										
											2018-10-04 09:13:22 -06:00
										 |  |  | 	options { | 
					
						
							| 
									
										
										
										
											2019-08-08 06:12:18 -06:00
										 |  |  | 		ansiColor('gnome-terminal') | 
					
						
							|  |  |  | 		throttle(['asterisk-gate']) | 
					
						
							| 
									
										
										
										
											2018-10-04 12:03:05 -06:00
										 |  |  | 		timestamps() | 
					
						
							| 
									
										
										
										
											2018-11-19 10:59:07 -07:00
										 |  |  | 		timeout(time: timeoutTime, unit: timeoutUnits) | 
					
						
							| 
									
										
										
										
											2018-10-04 09:13:22 -06:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 	triggers { | 
					
						
							|  |  |  | 		/* | 
					
						
							|  |  |  | 		 * This trigger will match either the "asterisk" or "Security-asterisk" | 
					
						
							|  |  |  | 		 * projects.  The branch is taken from the branch this job was created | 
					
						
							|  |  |  | 		 * for. | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		gerrit customUrl: '', | 
					
						
							|  |  |  | 			commentTextParameterMode: 'PLAIN', | 
					
						
							|  |  |  | 			commitMessageParameterMode: 'PLAIN', | 
					
						
							|  |  |  | 			gerritBuildSuccessfulVerifiedValue: 2, | 
					
						
							|  |  |  | 			gerritBuildFailedVerifiedValue: -1, | 
					
						
							|  |  |  | 			gerritBuildUnstableVerifiedValue: -1, | 
					
						
							|  |  |  | 			gerritProjects: [ | 
					
						
							|  |  |  | 				[branches: [[compareType: 'PLAIN', pattern: "${BRANCH_NAME}"]], | 
					
						
							|  |  |  | 					compareType: 'REG_EXP', | 
					
						
							|  |  |  | 					disableStrictForbiddenFileVerification: false, | 
					
						
							|  |  |  | 					pattern: '^(Security-)?asterisk.*' | 
					
						
							|  |  |  | 				] | 
					
						
							|  |  |  | 			], | 
					
						
							|  |  |  | 			silentMode: false, | 
					
						
							|  |  |  | 			triggerOnEvents: [ | 
					
						
							|  |  |  | 				commentAddedContains('^regate$'), | 
					
						
							|  |  |  | 				commentAdded(commentAddedTriggerApprovalValue: '+2', verdictCategory: 'Code-Review'), | 
					
						
							|  |  |  | 			], | 
					
						
							|  |  |  | 			skipVote: [ | 
					
						
							|  |  |  | 				onFailed: false, | 
					
						
							|  |  |  | 				onNotBuilt: true, | 
					
						
							|  |  |  | 				onSuccessful: false, | 
					
						
							|  |  |  | 				onUnstable: false | 
					
						
							|  |  |  | 			] | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-07-19 10:20:38 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 	agent { | 
					
						
							|  |  |  | 		/* All of the stages need to be performed on a docker host */ | 
					
						
							| 
									
										
										
										
											2019-08-06 09:40:54 -06:00
										 |  |  | 		label "asterisk-gate" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 	stages { | 
					
						
							|  |  |  | 		stage ("->") { | 
					
						
							|  |  |  | 			when { | 
					
						
							| 
									
										
										
										
											2019-08-08 06:12:18 -06:00
										 |  |  | 				/* | 
					
						
							|  |  |  | 				 * Jenkins will try to automatically rebuild this job when | 
					
						
							|  |  |  | 				 * the jenkinsfile changes but since this job is dependent on | 
					
						
							|  |  |  | 				 * Gerrit, we really don't want to do anything in that case. | 
					
						
							|  |  |  | 				 */ | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 				not { environment name: 'GERRIT_CHANGE_NUMBER', value: '' } | 
					
						
							| 
									
										
										
										
											2019-08-08 06:12:18 -06:00
										 |  |  | 				/* If "skip_gate" is in the comments, don't run the job */ | 
					
						
							|  |  |  | 				not { expression { env.GERRIT_EVENT_COMMENT_TEXT ==~ /.*skip_gate.*/ } } | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 			} | 
					
						
							|  |  |  | 			steps { | 
					
						
							|  |  |  | 				/* Here's where we switch to scripted pipeline */ | 
					
						
							|  |  |  | 				script { | 
					
						
							| 
									
										
										
										
											2018-07-26 17:54:36 -06:00
										 |  |  | 					manager.build.displayName = "${env.GERRIT_CHANGE_NUMBER}" | 
					
						
							|  |  |  | 					manager.createSummary("/plugin/workflow-job/images/48x48/pipelinejob.png").appendText("Docker Host: ${NODE_NAME}", false) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 					stage ("Checkout") { | 
					
						
							| 
									
										
										
										
											2019-07-19 10:20:38 -06:00
										 |  |  | 						sh "sudo chown -R jenkins:users ." | 
					
						
							| 
									
										
										
										
											2019-02-27 09:37:14 -07:00
										 |  |  | 						env.GERRIT_PROJECT_URL = env.GIT_URL.replaceAll(/[^\/]+$/, env.GERRIT_PROJECT) | 
					
						
							| 
									
										
										
										
											2019-07-19 10:20:38 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 						/* | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						 * Jenkins has already automatically checked out the base branch | 
					
						
							|  |  |  | 						 * for this change but we now need to check out the change itself | 
					
						
							|  |  |  | 						 * and rebase it on the current base branch.  If the rebase fails, | 
					
						
							|  |  |  | 						 * that's an indication to the user that they'll need to sort their | 
					
						
							|  |  |  | 						 * change out. | 
					
						
							|  |  |  | 						 * | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 						 * The Gerrit Trigger provides all the URLs and refspecs to | 
					
						
							|  |  |  | 						 * check out the change. | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 						 * | 
					
						
							|  |  |  | 						 * We need to retrieve the jenkins2 gerrit https credentials | 
					
						
							|  |  |  | 						 * in case this review is in a restricted project. | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 						 */ | 
					
						
							| 
									
										
										
										
											2018-08-16 12:28:03 -06:00
										 |  |  | 						withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}", | 
					
						
							|  |  |  | 							passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-08 11:10:11 -06:00
										 |  |  | 							sh "printenv -0 | sort -z | tr '\\0' '\\n'" | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 							checkout scm: [$class: 'GitSCM', | 
					
						
							|  |  |  | 								branches: [[name: env.GERRIT_BRANCH ]], | 
					
						
							|  |  |  | 								extensions: [ | 
					
						
							| 
									
										
										
										
											2019-02-27 09:37:14 -07:00
										 |  |  | 									[$class: 'ScmName', name: env.GERRIT_NAME], | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 									[$class: 'CleanBeforeCheckout'], | 
					
						
							|  |  |  | 									[$class: 'PreBuildMerge', options: [ | 
					
						
							| 
									
										
										
										
											2019-02-27 09:37:14 -07:00
										 |  |  | 										mergeRemote: env.GERRIT_NAME, | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 										fastForwardMode: 'NO_FF', | 
					
						
							|  |  |  | 										mergeStrategy: 'RECURSIVE', | 
					
						
							|  |  |  | 										mergeTarget: env.GERRIT_BRANCH]], | 
					
						
							|  |  |  | 									[$class: 'CloneOption', | 
					
						
							|  |  |  | 										honorRefspec: true, | 
					
						
							|  |  |  | 										noTags: true, | 
					
						
							| 
									
										
										
										
											2019-12-02 05:48:01 -07:00
										 |  |  | 										shallow: false | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 									], | 
					
						
							|  |  |  | 									[$class: 'PruneStaleBranch'], | 
					
						
							|  |  |  | 									[$class: 'BuildChooserSetting', | 
					
						
							|  |  |  | 										buildChooser: [$class: 'GerritTriggerBuildChooser'] | 
					
						
							|  |  |  | 									] | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 								], | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 								userRemoteConfigs: [ | 
					
						
							|  |  |  | 									[ | 
					
						
							|  |  |  | 									credentialsId: env.JENKINS_GERRIT_CREDS, | 
					
						
							|  |  |  | 									name: env.GERRIT_NAME, | 
					
						
							|  |  |  | 									refspec: env.GERRIT_REFSPEC, | 
					
						
							| 
									
										
										
										
											2018-08-16 12:28:03 -06:00
										 |  |  | 									url: env.GERRIT_PROJECT_URL.replaceAll("http(s)?://", "http\$1://${GERRIT_USER_NAME}@") | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 									] | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 								] | 
					
						
							|  |  |  | 							] | 
					
						
							| 
									
										
										
										
											2018-08-16 11:08:21 -06:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						sh "sudo tests/CI/setupJenkinsEnvironment.sh" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					def images = env.DOCKER_IMAGES.split(' ') | 
					
						
							|  |  |  | 					def r = currentBuild.startTimeInMillis % images.length | 
					
						
							|  |  |  | 					def ri = images[(int)r] | 
					
						
							|  |  |  | 					def randomImage = env.DOCKER_REGISTRY + "/" + ri | 
					
						
							| 
									
										
										
										
											2018-11-17 14:40:46 -07:00
										 |  |  | 					/* FYI... Jenkins takes care of mouting the workspace for the container */ | 
					
						
							| 
									
										
										
										
											2018-07-24 04:39:30 -06:00
										 |  |  | 					def dockerOptions = "--privileged --ulimit core=0 --ulimit nofile=10240 " + | 
					
						
							| 
									
										
										
										
											2019-02-19 16:06:32 +00:00
										 |  |  | 						" --tmpfs /tmp:exec,size=1G -v /srv/jenkins:/srv/jenkins:rw -v /srv/cache:/srv/cache:rw " + | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						" --entrypoint=''" | 
					
						
							| 
									
										
										
										
											2018-07-16 06:16:51 -06:00
										 |  |  | 					def bt = env.BUILD_TAG.replaceAll(/[^a-zA-Z0-9_.-]/, '-') | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 					def outputdir = "tests/CI/output/Testsuite" | 
					
						
							| 
									
										
										
										
											2018-07-26 10:34:20 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					manager.createSummary("/plugin/workflow-job/images/48x48/pipelinejob.png").appendText("Docker Image: ${randomImage}", false) | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 					def img = docker.image(randomImage) | 
					
						
							|  |  |  | 					img.pull() | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					stage ("Build") { | 
					
						
							| 
									
										
										
										
											2018-07-16 06:16:51 -06:00
										 |  |  | 						img.inside(dockerOptions + " --name ${bt}-build") { | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 							echo 'Building..' | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 							env.CCACHE_DIR = "/srv/cache/ccache" | 
					
						
							| 
									
										
										
										
											2018-07-25 09:20:20 -06:00
										 |  |  | 							sh "./tests/CI/buildAsterisk.sh --branch-name=${BRANCH_NAME} --output-dir=${outputdir} --cache-dir=/srv/cache" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 							archiveArtifacts allowEmptyArchive: true, defaultExcludes: false, fingerprint: false, | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 								artifacts: "${outputdir}/*" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-12 10:32:44 -06:00
										 |  |  | 					def testGroups | 
					
						
							|  |  |  | 					configFileProvider([configFile(fileId: 'asterisk_gate_test_groups', variable: 'GATE_TEST_GROUPS')]) { | 
					
						
							|  |  |  | 					echo "Retrieved config file from ${env.GATE_TEST_GROUPS}" | 
					
						
							|  |  |  | 						testGroups = readJSON file: env.GATE_TEST_GROUPS | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					echo "Running test groups:" | 
					
						
							|  |  |  | 					for (def testGroup in testGroups) { | 
					
						
							|  |  |  | 						echo "${testGroup.name} ${testGroup.dir} ${testGroup.testcmd}" | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 					def parallelTasks = [ : ] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					for (def testGroup in testGroups) { | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						/* | 
					
						
							|  |  |  | 						 * Because each task is a Groovy closure, we need to | 
					
						
							|  |  |  | 						 * keep local references to some variables. | 
					
						
							|  |  |  | 						 */ | 
					
						
							|  |  |  | 						def groupName = testGroup.name | 
					
						
							|  |  |  | 						def groupDir = testGroup.dir | 
					
						
							|  |  |  | 						def groupTestcmd = testGroup.testcmd | 
					
						
							| 
									
										
										
										
											2018-07-13 05:56:38 -06:00
										 |  |  | 						def testsuiteUrl = env.GERRIT_PROJECT_URL.replaceAll(/\/(Security-)?[^\/]+$/, "/\$1testsuite") | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 						parallelTasks[groupName] = { | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 							stage (groupName) { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 06:16:51 -06:00
										 |  |  | 								img.inside("${dockerOptions} --name ${bt}-${groupName}") { | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 									lock("${JOB_NAME}.${NODE_NAME}.installer") { | 
					
						
							| 
									
										
										
										
											2018-07-27 12:23:02 -06:00
										 |  |  | 										sh "sudo ./tests/CI/installAsterisk.sh --uninstall-all --branch-name=${BRANCH_NAME} --user-group=jenkins:users" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 									} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:54:04 -06:00
										 |  |  | 									sh "sudo rm -rf ${groupDir} || : " | 
					
						
							| 
									
										
										
										
											2019-07-19 10:20:38 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-14 11:31:28 -06:00
										 |  |  | 									withCredentials([usernamePassword(credentialsId: "${JENKINS_GERRIT_CREDS}", | 
					
						
							|  |  |  | 										passwordVariable: 'GERRIT_USER_PW', usernameVariable: 'GERRIT_USER_NAME')]) { | 
					
						
							|  |  |  | 										checkout scm: [$class: 'GitSCM', | 
					
						
							|  |  |  | 											branches: [[name: "${BRANCH_NAME}"]], | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 											extensions: [ | 
					
						
							|  |  |  | 												[$class: 'RelativeTargetDirectory', relativeTargetDir: groupDir], | 
					
						
							|  |  |  | 												[$class: 'CloneOption', | 
					
						
							|  |  |  | 													noTags: true, | 
					
						
							|  |  |  | 													honorRefspec: true, | 
					
						
							| 
									
										
										
										
											2019-12-02 05:48:01 -07:00
										 |  |  | 													shallow: false | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 												], | 
					
						
							|  |  |  | 											], | 
					
						
							| 
									
										
										
										
											2018-09-17 06:10:18 -06:00
										 |  |  | 											userRemoteConfigs: [ | 
					
						
							|  |  |  | 												[ | 
					
						
							|  |  |  | 												credentialsId: env.JENKINS_GERRIT_CREDS, | 
					
						
							| 
									
										
										
										
											2018-09-14 11:31:28 -06:00
										 |  |  | 												name: env.GERRIT_NAME, | 
					
						
							| 
									
										
										
										
											2018-09-17 06:10:18 -06:00
										 |  |  | 												url: testsuiteUrl.replaceAll("http(s)?://", "http\$1://${GERRIT_USER_NAME}@") | 
					
						
							|  |  |  | 												] | 
					
						
							|  |  |  | 											] | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 										] | 
					
						
							| 
									
										
										
										
											2018-09-14 11:31:28 -06:00
										 |  |  | 									} | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-17 14:40:46 -07:00
										 |  |  | 									sh "sudo tests/CI/runTestsuite.sh --testsuite-dir='${groupDir}' --testsuite-command='${groupTestcmd}'" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 									archiveArtifacts allowEmptyArchive: true, defaultExcludes: false, fingerprint: true, | 
					
						
							| 
									
										
										
										
											2018-07-11 13:54:04 -06:00
										 |  |  | 										artifacts: "${groupDir}/asterisk-test-suite-report.xml, ${groupDir}/logs/**, ${groupDir}/core*.txt" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-11 13:54:04 -06:00
										 |  |  | 									junit testResults: "${groupDir}/asterisk-test-suite-report.xml", | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 										healthScaleFactor: 1.0, | 
					
						
							|  |  |  | 										keepLongStdio: true | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | 									echo "Group result d: ${currentBuild.currentResult}" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 								} | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 								echo "Group result s: ${currentBuild.currentResult}" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 							} | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 					parallel parallelTasks | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	post { | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 		cleanup { | 
					
						
							| 
									
										
										
										
											2019-11-19 11:11:06 -07:00
										 |  |  | 			script { | 
					
						
							|  |  |  | 				if (env.CLEANUP_WS_GATES.toBoolean()) { | 
					
						
							|  |  |  | 					cleanWs deleteDirs: true, notFailBuild: false | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2019-11-19 07:51:56 -07:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		/* | 
					
						
							|  |  |  | 		 * The Gerrit Trigger will automatically post the "Verified" results back | 
					
						
							|  |  |  | 		 * to Gerrit but the verification publisher publishes extra stuff in the | 
					
						
							|  |  |  | 		 * "Code Review" section of the review. | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 		always { | 
					
						
							|  |  |  | 			script { | 
					
						
							|  |  |  | 				def cat | 
					
						
							|  |  |  | 				def comment | 
					
						
							| 
									
										
										
										
											2018-07-16 07:44:25 -06:00
										 |  |  | 				def rvalue | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 				switch (currentBuild.currentResult) { | 
					
						
							|  |  |  | 					case ~/^SUCCESS$/: | 
					
						
							|  |  |  | 						cat = "Passed" | 
					
						
							|  |  |  | 						comment = "" | 
					
						
							| 
									
										
										
										
											2018-07-16 07:44:25 -06:00
										 |  |  | 						rvalue = 2 | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						break | 
					
						
							|  |  |  | 					case ~/^FAILURE$/: | 
					
						
							|  |  |  | 						cat = "Failed" | 
					
						
							|  |  |  | 						comment = "Fatal Error" | 
					
						
							| 
									
										
										
										
											2018-07-16 07:44:25 -06:00
										 |  |  | 						rvalue = -1 | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						break | 
					
						
							|  |  |  | 					case ~/^UNSTABLE$/: | 
					
						
							|  |  |  | 						cat = "Failed" | 
					
						
							|  |  |  | 						comment = "Tests Failed" | 
					
						
							| 
									
										
										
										
											2018-07-16 07:44:25 -06:00
										 |  |  | 						rvalue = -1 | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 						break | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-16 07:44:25 -06:00
										 |  |  | 				gerritverificationpublisher verifyStatusValue: rvalue, | 
					
						
							|  |  |  | 					verifyStatusCategory: cat, verifyStatusURL: '', | 
					
						
							|  |  |  | 					verifyStatusComment: comment, verifyStatusName: '', | 
					
						
							|  |  |  | 					verifyStatusReporter: 'Jenkins2', verifyStatusRerun: 'regate' | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 		success { | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 			echo "Reporting ${currentBuild.currentResult} Passed" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		failure { | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 			echo "Reporting ${currentBuild.currentResult}: Failed: Fatal Error" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		unstable { | 
					
						
							| 
									
										
										
										
											2018-07-12 15:34:14 -06:00
										 |  |  | 			echo "Reporting ${currentBuild.currentResult}: Failed: Tests Failed" | 
					
						
							| 
									
										
										
										
											2018-07-11 13:00:38 -06:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |