source: Jenkins/FullBuild@ 91aa5ab

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 91aa5ab was 956910d, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Fix syntax of FullBuild script

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