source: Jenkins/FullBuild@ eb8d791

ADT ast-experimental
Last change on this file since eb8d791 was d3af505, checked in by Thierry Delisle <tdelisle@…>, 3 years ago

Full Build now only builds documentation in one of the sub builds

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