source: Jenkins/FullBuild@ 211413b

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 211413b was 9eb7a532, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Add random delay to bull build to distribute the start

  • Property mode set to 100644
File size: 5.2 KB
Line 
1#!groovy
2
3//===========================================================================================================
4// Main loop of the compilation
5//===========================================================================================================
6
7node ('master') {
8 def err = null
9
10 final scmVars = checkout scm
11 final commitId = scmVars.GIT_COMMIT
12
13 try {
14 //Wrap build to add timestamp to command line
15 wrap([$class: 'TimestamperBuildWrapper']) {
16
17 stage('Build') {
18
19 parallel (
20 gcc_8_x86_old: { trigger_build( 'gcc-8', 'x86', false ) },
21 gcc_7_x86_old: { trigger_build( 'gcc-7', 'x86', false ) },
22 gcc_6_x86_old: { trigger_build( 'gcc-6', 'x86', false ) },
23 gcc_9_x64_new: { trigger_build( 'gcc-9', 'x64', true ) },
24 gcc_8_x64_new: { trigger_build( 'gcc-8', 'x64', true ) },
25 gcc_7_x64_new: { trigger_build( 'gcc-7', 'x64', true ) },
26 gcc_6_x64_new: { trigger_build( 'gcc-6', 'x64', true ) },
27 gcc_5_x64_new: { trigger_build( 'gcc-5', 'x64', true ) },
28 clang_x64_new: { trigger_build( 'clang', 'x64', true ) },
29 clang_x64_old: { trigger_build( 'clang', 'x64', false ) },
30 )
31 }
32
33 stage('Package') {
34 trigger_dist( commitId, currentBuild.number.toString() )
35 }
36 }
37
38 promote_email(true)
39 }
40
41 //If an exception is caught we need to change the status and remember to
42 //attach the build log to the email
43 catch (Exception caughtError) {
44 echo('error caught')
45
46 //rethrow error later
47 err = caughtError
48
49 //Store the result of the build log
50 currentBuild.result = 'FAILURE'
51
52 //Send email to notify the failure
53 promote_email(false)
54 }
55
56 finally {
57 //Must re-throw exception to propagate error
58 if (err) {
59 throw err
60 }
61 }
62}
63//===========================================================================================================
64// Main compilation routines
65//===========================================================================================================
66
67def trigger_build(String cc, String arch, boolean new_ast) {
68 // Randomly delay the builds by a random amount to avoid hitting the SC server to hard
69 sleep(time: 5 * Math.random(), unit:"MINUTES")
70
71 // Run the build
72 // Don't propagate, it doesn't play nice with our email setup
73 def result = build job: 'Cforall/master', \
74 parameters: [ \
75 [$class: 'StringParameterValue', \
76 name: 'Compiler', \
77 value: cc], \
78 [$class: 'StringParameterValue', \
79 name: 'Architecture', \
80 value: arch], \
81 [$class: 'BooleanParameterValue', \
82 name: 'NewAST', \
83 value: new_ast], \
84 [$class: 'BooleanParameterValue', \
85 name: 'RunAllTests', \
86 value: true], \
87 [$class: 'BooleanParameterValue', \
88 name: 'RunBenchmark', \
89 value: true], \
90 [$class: 'BooleanParameterValue', \
91 name: 'BuildDocumentation', \
92 value: true], \
93 [$class: 'BooleanParameterValue', \
94 name: 'Publish', \
95 value: true], \
96 [$class: 'BooleanParameterValue', \
97 name: 'Silent', \
98 value: true], \
99 ], \
100 propagate: false
101
102 echo(result.result)
103
104 if(result.result != 'SUCCESS') {
105 sh("wget -q -O - http://localhost:8084/jenkins/job/Cforall/job/master/${result.number}/consoleText")
106 error(result.result)
107 }
108}
109
110def trigger_dist(String commitId, String buildNum) {
111 def result = build job: 'Cforall_Distribute_Ref', \
112 parameters: [ \
113 string(name: 'GitRef', value: commitId), \
114 string(name: 'Build' , value: buildNum) \
115 ], \
116 propagate: false
117
118 echo(result.result)
119
120 if(result.result != 'SUCCESS') {
121 sh("wget -q -O - https://cforall.uwaterloo.ca/jenkins/job/Cforall_Distribute_Ref/${result.number}/consoleText")
122 error(result.result)
123 }
124}
125
126//===========================================================================================================
127//Routine responsible of sending the email notification once the build is completed
128//===========================================================================================================
129
130//Email notification on a full build failure
131def promote_email(boolean success) {
132 echo('notifying users')
133
134 def result = success ? "PROMOTE - SUCCESS" : "PROMOTE - FAILURE"
135
136 //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
137 //Configurations for email format
138 def email_subject = "[cforall git][${result}]"
139 def email_body = """<p>This is an automated email from the Jenkins build machine. It was
140generated following the result of the C\u2200 nightly build.</p>
141
142<p>Check console output at ${env.BUILD_URL} to view the results.</p>
143
144<p>- Status --------------------------------------------------------------</p>
145
146<p>${result}</p>
147
148<p>- Performance ---------------------------------------------------------</p>
149
150<img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=0" >
151<img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=1" >
152
153<p>- Logs ----------------------------------------------------------------</p>
154"""
155
156 def email_to = "cforall@lists.uwaterloo.ca"
157
158 //send email notification
159 emailext body: email_body, subject: email_subject, to: email_to, attachLog: !success
160}
Note: See TracBrowser for help on using the repository browser.