source: Jenkins/FullBuild@ 556c6bc

Last change on this file since 556c6bc was 556c6bc, checked in by Peter A. Buhr <pabuhr@…>, 12 days ago

remove blank lines from groovy script

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