Changes in Jenkinsfile [6a531ab:91aa5ab]
- File:
-
- 1 edited
-
Jenkinsfile (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
r6a531ab r91aa5ab 30 30 SrcDir = pwd tmp: false 31 31 32 Tools.Clean()33 34 Tools.Checkout()32 clean() 33 34 checkout() 35 35 36 36 build() … … 81 81 // Main compilation routines 82 82 //=========================================================================================================== 83 def clean() { 84 Tools.BuildStage('Cleanup', true) { 85 // clean the build by wipping the build directory 86 dir(BuildDir) { 87 deleteDir() 88 } 89 } 90 } 91 92 //Compilation script is done here but environnement set-up and error handling is done in main loop 93 def checkout() { 94 Tools.BuildStage('Checkout', true) { 95 //checkout the source code and clean the repo 96 final scmVars = checkout scm 97 Settings.GitNewRef = scmVars.GIT_COMMIT 98 Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT 99 100 echo GitLogMessage() 101 } 102 } 103 83 104 def build() { 84 105 debug = true … … 215 236 //Routine responsible of sending the email notification once the build is completed 216 237 //=========================================================================================================== 238 @NonCPS 239 def SplitLines(String text) { 240 def list = [] 241 242 text.eachLine { 243 list += it 244 } 245 246 return list 247 } 248 249 def GitLogMessage() { 250 if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n" 251 252 def oldRef = Settings.GitOldRef 253 def newRef = Settings.GitNewRef 254 255 def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim() 256 def revList = SplitLines( revText ) 257 258 def gitUpdate = "" 259 revList.each { rev -> 260 def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim() 261 gitUpdate = gitUpdate + " via ${rev} (${type})" 262 } 263 264 def rev = oldRef 265 def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim() 266 gitUpdate = gitUpdate + " from ${rev} (${type})" 267 268 def gitLog = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim() 269 270 def gitDiff = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim() 271 gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">') 272 gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">') 273 gitDiff = gitDiff.replace('[m', '</span>') 274 275 return """ 276 <pre> 277 The branch ${env.BRANCH_NAME} has been updated. 278 ${gitUpdate} 279 </pre> 280 281 <p>Check console output at ${env.BUILD_URL} to view the results.</p> 282 283 <p>- Status --------------------------------------------------------------</p> 284 285 <p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p> 286 287 <p>- Log -----------------------------------------------------------------</p> 288 289 <pre> 290 ${gitLog} 291 </pre> 292 293 <p>-----------------------------------------------------------------------</p> 294 <pre> 295 Summary of changes: 296 ${gitDiff} 297 </pre> 298 """ 299 } 300 217 301 //Standard build email notification 218 302 def email(boolean log) { … … 226 310 generated because of a git hooks/post-receive script following 227 311 a ref change which was pushed to the C\u2200 repository.</p> 228 """ + Tools.GitLogMessage()312 """ + GitLogMessage() 229 313 230 314 def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca" … … 336 420 this.DescShort = "${ this.Compiler.name }:${ this.Architecture.name }${full}" 337 421 338 final ast = this.NewAST ? "New AST" : "Old AST"339 422 this.DescLong = """Compiler : ${ this.Compiler.name } (${ this.Compiler.CXX }/${ this.Compiler.CC }) 340 AST Version : ${ ast.toString() }341 423 Architecture : ${ this.Architecture.name } 342 424 Arc Flags : ${ this.Architecture.flags } … … 391 473 description: 'If true, build compiler using new AST', \ 392 474 name: 'NewAST', \ 393 defaultValue: true, \475 defaultValue: false, \ 394 476 ], \ 395 477 [$class: 'BooleanParameterDefinition', \ … … 397 479 name: 'RunAllTests', \ 398 480 defaultValue: false, \ 399 ], \481 ], 400 482 [$class: 'BooleanParameterDefinition', \ 401 483 description: 'If true, jenkins also runs benchmarks', \
Note:
See TracChangeset
for help on using the changeset viewer.