Changeset 5afeab9 for Jenkinsfile
- Timestamp:
- Aug 17, 2018, 1:46:35 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- c431138
- Parents:
- 155c2a28
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
r155c2a28 r5afeab9 6 6 node ('master'){ 7 7 8 boolean bIsSandbox = env.BRANCH_NAME == "jenkins-sandbox"9 8 def err = null 10 9 def log_needed = false … … 26 25 notify_server(0) 27 26 28 final settings = prepare_build()27 final Settings = prepare_build() 29 28 30 29 clean() … … 63 62 finally { 64 63 //Send email with final results if this is not a full build 65 if( ! params.Silent ) {64 if( !Settings.Silent ) { 66 65 echo 'Notifying users of result' 67 66 email(currentBuild.result, log_needed, bIsSandbox) … … 80 79 // Helper classes/variables/routines 81 80 //=========================================================================================================== 82 //Helper routine to collect information about the git history83 def collect_git_info() {84 85 final scmVars = checkout scm86 echo "----------------------------------------"87 echo "${scmVars.getClass()}"88 echo "scmVars: ${scmVars}"89 90 //create the temporary output directory in case it doesn't already exist91 def out_dir = pwd tmp: true92 sh "mkdir -p ${out_dir}"93 94 //parse git logs to find what changed95 gitRefName = env.BRANCH_NAME96 sh "git reflog > ${out_dir}/GIT_COMMIT"97 git_reflog = readFile("${out_dir}/GIT_COMMIT")98 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]99 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]100 }101 102 81 class BuildSettings implements Serializable { 103 BuildSettings() { 82 public final CC_Desc Compiler 83 public final Arch_Desc Architecture 84 public final Boolean RunAllTests 85 public final Boolean RunBenchmark 86 public final Boolean BuildDocumentation 87 public final Boolean Publish 88 public final Boolean Silent 89 public final Boolean IsSandbox 90 public final String Branch 91 public final String Commit 92 public final String PrevCommit 93 public final String RepoUrl 94 public final String DescLong 95 public final String DescShort 96 97 BuildSettings(java.util.Collections$UnmodifiableMap param, java.util.TreeMap scmVars) { 98 echo "${env}" 99 100 this.Compiler = compiler_from_params( params.Compiler ) 101 this.Architecture = architecture_from_params( params.Architecture ) 102 this.RunAllTests = params.RunAllTests 103 this.RunBenchmark = params.RunBenchmark 104 this.BuildDocumentation = params.BuildDocumentation 105 this.Publish = params.Publish 106 this.Silent = params.Silent 107 this.IsSandbox = scmVars.GIT_BRANCH == "jenkins-sandbox" 108 this.Branch = scmVars.GIT_BRANCH 109 this.Commit = scmVars.GIT_COMMIT 110 this.PrevCommit = scmVars.GIT_PREVIOUS_COMMIT 111 this.RepoUrl = scmVars.GIT_URL 112 113 def full = params.RunAllTests ? " (Full)" : "" 114 this.DescShort = "${ this.Compiler.cc_name }:${ this.Architecture.name }${full}" 115 116 this.DescLong """Compiler : ${ this.Compiler.cc_name } (${ this.Compiler.cpp_cc }/${ this.Compiler.cfa_cc }) 117 Architecture : ${ this.Architecture.name } 118 Arc Flags : ${ this.Architecture.flags } 119 Run All Tests : ${ this.RunAllTests.toString() } 120 Run Benchmark : ${ this.RunBenchmark.toString() } 121 Build Documentation : ${ this.BuildDocumentation.toString() } 122 Publish : ${ this.Publish.toString() } 123 Silent : ${ this.Silent.toString() } 124 """ 104 125 } 105 126 } 106 127 107 128 def prepare_build() { 108 collect_git_info() 109 129 // prepare the properties 110 130 properties ([ \ 111 131 [$class: 'ParametersDefinitionProperty', \ … … 151 171 ]]) 152 172 153 echo "${params.getClass()}" 154 155 compiler = compiler_from_params( params.Compiler ) 156 crchitecture = architecture_from_params( params.Architecture ) 157 158 def full = params.RunAllTests ? " (Full)" : "" 159 currentBuild.description = "${ compiler.cc_name }:${ architecture.name }${full}" 160 161 echo """Compiler : ${ params.Compiler.cc_name } (${ compiler.cpp_cc }/${ compiler.cfa_cc }) 162 Architecture : ${ architecture.name } 163 Arc Flags : ${ architecture.flags } 164 Run All Tests : ${ params.RunAllTests.toString() } 165 Run Benchmark : ${ params.RunBenchmark.toString() } 166 Build Documentation : ${ params.BuildDocumentation.toString() } 167 Publish : ${ params.Publish.toString() } 168 Silent : ${ params.Silent.toString() } 169 """ 173 // Collect git information 174 final scmVars = checkout scm 175 176 final settings = new BuildSettings(params, scmVars) 177 178 currentBuild.description = settings.DescShort 179 echo settings.DescLong 180 181 return settings 170 182 } 171 183 … … 285 297 //Also specify the compiler by hand 286 298 targets="" 287 if( params.RunAllTests ) {299 if( Settings.RunAllTests ) { 288 300 targets="--with-target-hosts='host:debug,host:nodebug'" 289 301 } else { … … 291 303 } 292 304 293 sh "${srcdir}/configure CXX=${ params.Compiler.cpp_cc} ${params.Architecture.flags} ${targets} --with-backend-compiler=${params.Compiler.cfa_cc} --quiet"305 sh "${srcdir}/configure CXX=${Settings.Compiler.cpp_cc} ${Settings.Architecture.flags} ${targets} --with-backend-compiler=${Settings.Compiler.cfa_cc} --quiet" 294 306 295 307 //Compile the project … … 304 316 dir (builddir) { 305 317 //Run the tests from the tests directory 306 if ( params.RunAllTests ) {318 if ( Settings.RunAllTests ) { 307 319 sh 'make --no-print-directory -C tests all-tests debug=yes' 308 320 sh 'make --no-print-directory -C tests all-tests debug=no ' … … 318 330 build_stage('Benchmark') { 319 331 320 if( ! params.RunBenchmark ) return332 if( !Settings.RunBenchmark ) return 321 333 322 334 dir (builddir) { 323 335 //Append bench results 324 sh "make --no-print-directory -C benchmark jenkins githash=${gitRefNewValue} arch=${ params.Architecture} | tee ${srcdir}/bench.json"336 sh "make --no-print-directory -C benchmark jenkins githash=${gitRefNewValue} arch=${Settings.Architecture} | tee ${srcdir}/bench.json" 325 337 } 326 338 } … … 330 342 build_stage('Documentation') { 331 343 332 if( ! params.BuildDocumentation ) return344 if( !Settings.BuildDocumentation ) return 333 345 334 346 dir ('doc/user') { … … 345 357 build_stage('Publish') { 346 358 347 if( ! params.Publish ) return359 if( !Settings.Publish ) return 348 360 349 361 //Then publish the results … … 386 398 387 399 try { 388 gitUpdate = gitBranchUpdate( gitRefOldValue, gitRefNewValue)389 390 sh "git rev-list --format=short ${ gitRefOldValue}...${gitRefNewValue} > GIT_LOG"400 gitUpdate = gitBranchUpdate(Settings.PrevCommit, Settings.Commit) 401 402 sh "git rev-list --format=short ${Settings.PrevCommit}...${Settings.Commit} > GIT_LOG" 391 403 gitLog = readFile('GIT_LOG') 392 404 393 sh "git diff --stat ${ gitRefNewValue} ${gitRefOldValue} > GIT_DIFF"405 sh "git diff --stat ${Settings.Commit} ${Settings.PrevCommit} > GIT_DIFF" 394 406 gitDiff = readFile('GIT_DIFF') 395 407 }
Note: See TracChangeset
for help on using the changeset viewer.