source: Jenkins/FullBuild

Last change on this file was 54c01bb, checked in by Peter A. Buhr <pabuhr@…>, 3 days ago

2nd attempt to turn on ARM builds on algol

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