Changeset 6a531ab
- Timestamp:
- Dec 4, 2020, 12:52:04 PM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 143cbf1
- Parents:
- 8271891
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Jenkins/tools.groovy
r8271891 r6a531ab 61 61 } 62 62 63 def GitLogMessage(String oldRef, String newRef) { 63 PrevGitOldRef = '' 64 PrevGitNewRef = '' 65 def GitLogMessage(String oldRef = '', String newRef = '') { 66 if (!PrevGitOldRef || !oldRef) return "\nERROR retrieveing git information!\n" 67 PrevGitOldRef = oldRef 68 69 if (!PrevGitNewRef || !newRef) return "\nERROR retrieveing git information!\n" 70 PrevGitNewRef = newRef 71 64 72 def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim() 65 73 def revList = SplitLines( revText ) -
Jenkinsfile
r8271891 r6a531ab 30 30 SrcDir = pwd tmp: false 31 31 32 clean()33 34 checkout()32 Tools.Clean() 33 34 Tools.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 directory86 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 loop93 def checkout() {94 Tools.BuildStage('Checkout', true) {95 //checkout the source code and clean the repo96 final scmVars = checkout scm97 Settings.GitNewRef = scmVars.GIT_COMMIT98 Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT99 100 echo GitLogMessage()101 }102 }103 104 83 def build() { 105 84 debug = true … … 236 215 //Routine responsible of sending the email notification once the build is completed 237 216 //=========================================================================================================== 238 @NonCPS239 def SplitLines(String text) {240 def list = []241 242 text.eachLine {243 list += it244 }245 246 return list247 }248 249 def GitLogMessage() {250 if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n"251 252 def oldRef = Settings.GitOldRef253 def newRef = Settings.GitNewRef254 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 = oldRef265 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 301 217 //Standard build email notification 302 218 def email(boolean log) { … … 310 226 generated because of a git hooks/post-receive script following 311 227 a ref change which was pushed to the C\u2200 repository.</p> 312 """ + GitLogMessage()228 """ + Tools.GitLogMessage() 313 229 314 230 def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca" … … 475 391 description: 'If true, build compiler using new AST', \ 476 392 name: 'NewAST', \ 477 defaultValue: false, \393 defaultValue: true, \ 478 394 ], \ 479 395 [$class: 'BooleanParameterDefinition', \
Note: See TracChangeset
for help on using the changeset viewer.