Fix reporting for flaky builds in Jenkinsfile
The verification pipeline was not properly reporting the results of builds that were suspect to being flaky. This happened, because the build did not save the results in a variable, if the propagate option was used, which had to be done for the pipeline plugin's retry command to work. Instead of using the retry-command provided by the pipeline plugin, the Jenkinsfile implements this behaviour manually. Bug: Issue 11927 Change-Id: I419a20f69cabc4c54d7f57fd04ad354563eafd71
This commit is contained in:
		
				
					committed by
					
						
						Thomas Dräbing
					
				
			
			
				
	
			
			
			
						parent
						
							1a134ba6d4
						
					
				
				
					commit
					bf79cd73eb
				
			
							
								
								
									
										14
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@@ -154,18 +154,19 @@ def collectBuildModes() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
 | 
			
		||||
    def propagate = retryTimes == 1 ? false : true
 | 
			
		||||
    return {
 | 
			
		||||
        stage("${buildName}/${mode}") {
 | 
			
		||||
            catchError{
 | 
			
		||||
                retry(retryTimes){
 | 
			
		||||
                    def slaveBuild = build job: "${buildName}", parameters: [
 | 
			
		||||
            def slaveBuild = null
 | 
			
		||||
            for (int i = 1; i <= retryTimes; i++) {
 | 
			
		||||
                try {
 | 
			
		||||
                    slaveBuild = build job: "${buildName}", parameters: [
 | 
			
		||||
                        string(name: 'REFSPEC', value: Change.ref),
 | 
			
		||||
                        string(name: 'BRANCH', value: Change.sha1),
 | 
			
		||||
                        string(name: 'CHANGE_URL', value: Change.url),
 | 
			
		||||
                        string(name: 'MODE', value: mode),
 | 
			
		||||
                        string(name: 'TARGET_BRANCH', value: Change.branch)
 | 
			
		||||
                    ], propagate: propagate
 | 
			
		||||
                    ], propagate: false
 | 
			
		||||
                } finally {
 | 
			
		||||
                    if (buildName == "Gerrit-codestyle"){
 | 
			
		||||
                        Builds.codeStyle = new Build(
 | 
			
		||||
                            slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
 | 
			
		||||
@@ -173,6 +174,9 @@ def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
 | 
			
		||||
                        Builds.verification[mode] = new Build(
 | 
			
		||||
                            slaveBuild.getAbsoluteUrl(), slaveBuild.getResult())
 | 
			
		||||
                    }
 | 
			
		||||
                    if (slaveBuild.getResult() == "SUCCESS") {
 | 
			
		||||
                        break
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user