source: Jenkins/FullBuild@ 7d4ce2a

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 7d4ce2a was 8089fde, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Full build now builds new ast.
Full build now distribute builds.
Fixed stages in distribute.

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