source: Jenkins/FullBuild@ c6363b4

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

try the full build with gcc-12

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