source: Jenkins/FullBuild@ 98168b9

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum stuck-waitfor-destruct
Last change on this file since 98168b9 was 98168b9, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

Fix how full build fetches git commit

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