You've already forked sap-jenkins-library
							
							
				mirror of
				https://github.com/SAP/jenkins-library.git
				synced 2025-10-30 23:57:50 +02:00 
			
		
		
		
	- send "build failed" mail only when an exception has been received. - provide a non empty mail message, since an empty mail body causes the build to fail.
		
			
				
	
	
		
			20 lines
		
	
	
		
			601 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			601 B
		
	
	
	
		
			Groovy
		
	
	
	
	
	
| node {
 | |
|     try {
 | |
|         lock(resource: "sap-jenkins-library/10", inversePrecedence: true) {
 | |
|             milestone 10
 | |
|             deleteDir()
 | |
|             stage ('Checkout'){
 | |
|                 checkout scm
 | |
|             }
 | |
|             stage ('Test') {
 | |
|                 sh "mvn clean test --batch-mode"
 | |
|             }
 | |
|         }
 | |
|     } catch (Throwable err) {
 | |
|         echo "Error occured: ${err}"
 | |
|         currentBuild.result = 'FAILURE'
 | |
|         mail subject: '[Build failed] SAP/jenkins-library', body: 'Fix the build.', to: 'k.arnold@sap.com,marcus.holl@sap.com,oliver.nocon@sap.com'
 | |
|         throw err
 | |
|     } 
 | |
| }
 |