Changes in Jenkinsfile [cc9ec56:bd50205]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
rcc9ec56 rbd50205 7 7 //=========================================================================================================== 8 8 9 node('master') { 10 // Globals 11 BuildDir = pwd tmp: true 12 SrcDir = pwd tmp: false 13 Settings= null14 Tools = null 15 16 // Local variables 17 def err = null 18 def log_needed = false 19 20 currentBuild.result = "SUCCESS" 21 22 try{9 // Globals 10 BuildDir = null 11 SrcDir = null 12 Settings = null 13 Tools = null 14 15 // Local variables 16 def err = null 17 def log_needed = false 18 19 currentBuild.result = "SUCCESS" 20 21 try { 22 node { 23 23 //Wrap build to add timestamp to command line 24 24 wrap([$class: 'TimestamperBuildWrapper']) { 25 26 25 Settings = prepare_build() 27 28 node(Settings.Architecture.node) { 29 BuildDir = pwd tmp: true 30 SrcDir = pwd tmp: false 31 currentBuild.description = "${currentBuild.description} on ${env.NODE_NAME}" 32 33 Tools.Clean() 34 35 Tools.Checkout() 36 37 build() 38 39 test() 40 41 benchmark() 42 43 build_doc() 44 45 publish() 46 } 47 48 // Update the build directories when exiting the node 26 } 27 } 28 29 node(Settings.Architecture.node) { 30 //Wrap build to add timestamp to command line 31 wrap([$class: 'TimestamperBuildWrapper']) { 49 32 BuildDir = pwd tmp: true 50 33 SrcDir = pwd tmp: false 51 } 52 } 53 54 //If an exception is caught we need to change the status and remember to 55 //attach the build log to the email 56 catch (Exception caughtError) { 57 // Store the result of the build log 58 currentBuild.result = "FAILURE" 59 60 // An error has occured, the build log is relevent 61 log_needed = true 62 63 // rethrow error later 64 err = caughtError 65 66 // print the error so it shows in the log 67 echo err.toString() 68 } 69 70 finally { 71 //Send email with final results if this is not a full build 72 email(log_needed) 73 74 echo 'Build Completed' 75 76 /* Must re-throw exception to propagate error */ 77 if (err) { 78 throw err 79 } 34 currentBuild.description = "${currentBuild.description} on ${env.NODE_NAME}" 35 36 Tools.Clean() 37 38 Tools.Checkout() 39 40 build() 41 42 test() 43 44 benchmark() 45 46 build_doc() 47 48 publish() 49 } 50 } 51 } 52 53 //If an exception is caught we need to change the status and remember to 54 //attach the build log to the email 55 catch (Exception caughtError) { 56 // Store the result of the build log 57 currentBuild.result = "FAILURE" 58 59 // An error has occured, the build log is relevent 60 log_needed = true 61 62 // rethrow error later 63 err = caughtError 64 65 // print the error so it shows in the log 66 echo err.toString() 67 } 68 69 finally { 70 //Send email with final results if this is not a full build 71 email(log_needed) 72 73 echo 'Build Completed' 74 75 /* Must re-throw exception to propagate error */ 76 if (err) { 77 throw err 80 78 } 81 79 } … … 228 226 //Standard build email notification 229 227 def email(boolean log) { 230 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line 231 //Configurations for email format 232 echo 'Notifying users of result' 233 234 def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() 235 def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}" 236 def email_body = """<p>This is an automated email from the Jenkins build machine. It was 237 generated because of a git hooks/post-receive script following 238 a ref change which was pushed to the C\u2200 repository.</p> 239 """ + Tools.GitLogMessage() 240 241 def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca" 242 243 if( Settings && !Settings.Silent ) { 244 //send email notification 245 emailext body: email_body, subject: email_subject, to: email_to, attachLog: log 246 } else { 247 echo "Would send email to: ${email_to}" 248 echo "With title: ${email_subject}" 249 echo "Content: \n${email_body}" 228 node { 229 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line 230 //Configurations for email format 231 echo 'Notifying users of result' 232 233 def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() 234 def email_subject = "[${project_name} git][BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}] - branch ${env.BRANCH_NAME}" 235 def email_body = """<p>This is an automated email from the Jenkins build machine. It was 236 generated because of a git hooks/post-receive script following 237 a ref change which was pushed to the C\u2200 repository.</p> 238 """ + Tools.GitLogMessage() 239 240 def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca" 241 242 if( Settings && !Settings.Silent ) { 243 //send email notification 244 emailext body: email_body, subject: email_subject, to: email_to, attachLog: log 245 } else { 246 echo "Would send email to: ${email_to}" 247 echo "With title: ${email_subject}" 248 echo "Content: \n${email_body}" 249 } 250 250 } 251 251 }
Note: See TracChangeset
for help on using the changeset viewer.