source: Jenkins/FullBuild @ b19fdb9

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since b19fdb9 was b19fdb9, checked in by Thierry Delisle <tdelisle@…>, 3 years ago

FullBuild? should now properly show errors when distribution fails

  • Property mode set to 100644
File size: 4.9 KB
Line 
1#!groovy
2
3//===========================================================================================================
4// Main loop of the compilation
5//===========================================================================================================
6
7node ('master') {
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
17                        stage('Build') {
18
19                                parallel (
20                                        gcc_8_x86_old: { trigger_build( 'gcc-8',   'x86', false ) },
21                                        gcc_7_x86_old: { trigger_build( 'gcc-7',   'x86', false ) },
22                                        gcc_6_x86_old: { trigger_build( 'gcc-6',   'x86', false ) },
23                                        gcc_9_x64_old: { trigger_build( 'gcc-9',   'x64', false ) },
24                                        gcc_8_x64_old: { trigger_build( 'gcc-8',   'x64', false ) },
25                                        gcc_7_x64_old: { trigger_build( 'gcc-7',   'x64', false ) },
26                                        gcc_6_x64_old: { trigger_build( 'gcc-6',   'x64', false ) },
27                                        gcc_5_x64_old: { trigger_build( 'gcc-5',   'x64', false ) },
28                                        clang_x64_old: { trigger_build( 'clang',   'x64', false ) },
29                                        clang_x64_new: { trigger_build( 'clang',   'x64', true  ) },
30                                )
31                        }
32
33                        stage('Package') {
34                                trigger_dist( commitId, currentBuild.number.toString() )
35                        }
36                }
37
38                promote_email(true)
39        }
40
41        //If an exception is caught we need to change the status and remember to
42        //attach the build log to the email
43        catch (Exception caughtError) {
44                echo('error caught')
45
46                //rethrow error later
47                err = caughtError
48
49                //Store the result of the build log
50                currentBuild.result = 'FAILURE'
51
52                //Send email to notify the failure
53                promote_email(false)
54        }
55
56        finally {
57                //Must re-throw exception to propagate error
58                if (err) {
59                        throw err
60                }
61        }
62}
63//===========================================================================================================
64// Main compilation routines
65//===========================================================================================================
66
67def trigger_build(String cc, String arch, boolean new_ast) {
68        def result = build job: 'Cforall/master',               \
69                parameters: [                                           \
70                        [$class: 'StringParameterValue',                \
71                          name: 'Compiler',                             \
72                          value: cc],                                   \
73                        [$class: 'StringParameterValue',                \
74                          name: 'Architecture',                         \
75                          value: arch],                                 \
76                        [$class: 'BooleanParameterValue',               \
77                          name: 'NewAST',                               \
78                          value: new_ast],                              \
79                        [$class: 'BooleanParameterValue',               \
80                          name: 'RunAllTests',                          \
81                          value: true],                                         \
82                        [$class: 'BooleanParameterValue',               \
83                          name: 'RunBenchmark',                         \
84                          value: true],                                         \
85                        [$class: 'BooleanParameterValue',               \
86                          name: 'BuildDocumentation',           \
87                          value: true],                                         \
88                        [$class: 'BooleanParameterValue',               \
89                          name: 'Publish',                              \
90                          value: true],                                         \
91                        [$class: 'BooleanParameterValue',               \
92                          name: 'Silent',                               \
93                          value: true],                                         \
94                ],                                                              \
95                propagate: false
96
97        echo(result.result)
98
99        if(result.result != 'SUCCESS') {
100                sh("wget -q -O - http://localhost:8084/jenkins/job/Cforall/job/master/${result.number}/consoleText")
101                error(result.result)
102        }
103}
104
105def trigger_dist(String commitId, String build) {
106        def result = build job: 'Cforall_Distribute_Ref',       \
107                parameters: [                                           \
108                        string(name: 'GitRef', value: commitId),        \
109                        string(name: 'Build' , value: build)    \
110                ]
111
112        echo(result.result)
113
114        if(result.result != 'SUCCESS') {
115                sh("wget -q -O - https://cforall.uwaterloo.ca/jenkins/job/Cforall_Distribute_Ref/${result.number}/consoleText")
116                error(result.result)
117        }
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.