source: Jenkins/FullBuild@ 98d4df9

ADT arm-eh ast-experimental cleanup-dtors enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 98d4df9 was 986e260, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Removed utf-8 character in groovy files and replaced with unicode escape

  • Property mode set to 100644
File size: 4.4 KB
RevLine 
[ae28ee2]1#!groovy
2
3//===========================================================================================================
4// Main loop of the compilation
5//===========================================================================================================
6
7node ('master') {
8 def err = null
9
10 try {
[f408e1a]11 //Wrap build to add timestamp to command line
12 wrap([$class: 'TimestamperBuildWrapper']) {
13
14 stage('Build') {
15
16 results = [null, null]
17
18 parallel (
19 gcc_6_x64: { trigger_build( 'gcc-6', 'x64', true ) },
20 gcc_6_x86: { trigger_build( 'gcc-6', 'x86', true ) },
21 gcc_5_x64: { trigger_build( 'gcc-5', 'x64', false ) },
22 gcc_5_x86: { trigger_build( 'gcc-5', 'x86', false ) },
23 clang_x64: { trigger_build( 'clang', 'x64', false ) },
24 clang_x86: { trigger_build( 'clang', 'x86', false ) },
25 )
[ae28ee2]26 }
27 }
[13c98a4]28
29 promote_email(true)
[ae28ee2]30 }
31
32 //If an exception is caught we need to change the status and remember to
33 //attach the build log to the email
34 catch (Exception caughtError) {
35 echo('error caught')
36
37 //rethrow error later
38 err = caughtError
39
40 //Store the result of the build log
41 currentBuild.result = 'FAILURE'
42
43 //Send email to notify the failure
[13c98a4]44 promote_email(false)
[ae28ee2]45 }
46
47 finally {
48 //Must re-throw exception to propagate error
49 if (err) {
50 throw err
51 }
52 }
53}
54//===========================================================================================================
55// Main compilation routines
56//===========================================================================================================
57
[3831b58]58def trigger_build(String cc, String arch, Boolean publish) {
[ae28ee2]59 def result = build job: 'Cforall/master', \
60 parameters: [ \
[8fa3c7e6]61 [$class: 'StringParameterValue', \
[0c1d240]62 name: 'Compiler', \
[8fa3c7e6]63 value: cc], \
64 [$class: 'StringParameterValue', \
[0c1d240]65 name: 'Architecture', \
[8fa3c7e6]66 value: arch], \
[ae28ee2]67 [$class: 'BooleanParameterValue', \
[0c1d240]68 name: 'RunAllTests', \
[8fa3c7e6]69 value: true], \
70 [$class: 'BooleanParameterValue', \
[0c1d240]71 name: 'RunBenchmark', \
[8fa3c7e6]72 value: true], \
73 [$class: 'BooleanParameterValue', \
[0c1d240]74 name: 'BuildDocumentation', \
[8fa3c7e6]75 value: true], \
76 [$class: 'BooleanParameterValue', \
[0c1d240]77 name: 'Publish', \
78 value: publish], \
[8fa3c7e6]79 [$class: 'BooleanParameterValue', \
[0c1d240]80 name: 'Silent', \
[ae28ee2]81 value: true], \
82 ], \
83 propagate: false
84
85 echo(result.result)
86
87 if(result.result != 'SUCCESS') {
[27474a7]88 sh("wget -q -O - http://localhost:8084/jenkins/job/Cforall/job/master/${result.number}/consoleText")
[ae28ee2]89 error(result.result)
90 }
91}
92
93//Helper routine to collect information about the git history
94def collect_git_info() {
95
96 //create the temporary output directory in case it doesn't already exist
97 def out_dir = pwd tmp: true
98 sh "mkdir -p ${out_dir}"
99
100 //parse git logs to find what changed
101 dir("../Cforall_Full_Build@script") {
102 sh "git reflog > ${out_dir}/GIT_COMMIT"
103 }
104 git_reflog = readFile("${out_dir}/GIT_COMMIT")
105 gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]
106 gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]
107}
108
109//===========================================================================================================
110//Routine responsible of sending the email notification once the build is completed
111//===========================================================================================================
112
113//Email notification on a full build failure
[13c98a4]114def promote_email(boolean success) {
[ae28ee2]115 echo('notifying users')
116
[13c98a4]117 def result = success ? "PROMOTE - SUCCESS" : "PROMOTE - FAILURE"
118
[ae28ee2]119 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
120 //Configurations for email format
[13c98a4]121 def email_subject = "[cforall git][${result}]"
122 def email_body = """<p>This is an automated email from the Jenkins build machine. It was
[986e260]123generated following the result of the C\u2200 nightly build.</p>
[13c98a4]124
125<p>Check console output at ${env.BUILD_URL} to view the results.</p>
126
127<p>- Status --------------------------------------------------------------</p>
[ae28ee2]128
[13c98a4]129<p>${result}</p>
[ae28ee2]130
[b7b573c]131<p>- Performance ---------------------------------------------------------</p>
[ae28ee2]132
[38c0fe5]133<img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=0" >
[b7b573c]134
135<p>- Logs ----------------------------------------------------------------</p>
[ae28ee2]136"""
137
[e39647e]138 def email_to = "cforall@lists.uwaterloo.ca"
[ae28ee2]139
140 //send email notification
[13c98a4]141 emailext body: email_body, subject: email_subject, to: email_to, attachLog: !success
[ae28ee2]142}
Note: See TracBrowser for help on using the repository browser.