source: Jenkins/FullBuild @ c702d21

ADTast-experimentalpthread-emulation
Last change on this file since c702d21 was 02a3972, checked in by Thierry Delisle <tdelisle@…>, 19 months ago

Fixed full build to use the compilers ada has

  • Property mode set to 100644
File size: 5.1 KB
Line 
1#!groovy
2
3//===========================================================================================================
4// Main loop of the compilation
5//===========================================================================================================
6
7node {
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_08_x86_new: { trigger_build( 'gcc-10',  'x86' ) },
21                                        gcc_07_x86_new: { trigger_build( 'gcc-9',   'x86' ) },
22                                        gcc_10_x64_new: { trigger_build( 'gcc-10',  'x64' ) },
23                                        gcc_09_x64_new: { trigger_build( 'gcc-9',   'x64' ) },
24                                        gcc_08_x64_new: { trigger_build( 'gcc-8',   'x64' ) },
25                                        gcc_07_x64_new: { trigger_build( 'gcc-7',   'x64' ) },
26                                        gcc_06_x64_new: { trigger_build( 'gcc-6',   'x64' ) },
27                                        clang_x64_new:  { trigger_build( 'clang',   'x64' ) },
28                                )
29                        }
30
31                        stage('Package') {
32                                trigger_dist( commitId, currentBuild.number.toString() )
33                        }
34
35                        stage('Promote') {
36                                trigger_prom()
37                        }
38                }
39
40                promote_email(true)
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
55                promote_email(false)
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
69def trigger_build(String cc, String arch) {
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
75        def result = build job: 'Cforall/master',               \
76                parameters: [                                           \
77                        [$class: 'StringParameterValue',                \
78                          name: 'Compiler',                             \
79                          value: cc],                                   \
80                        [$class: 'StringParameterValue',                \
81                          name: 'Architecture',                         \
82                          value: arch],                                 \
83                        [$class: 'BooleanParameterValue',               \
84                          name: 'NewAST',                               \
85                          value: true],                                         \
86                        [$class: 'BooleanParameterValue',               \
87                          name: 'RunAllTests',                          \
88                          value: true],                                         \
89                        [$class: 'BooleanParameterValue',               \
90                          name: 'RunBenchmark',                         \
91                          value: true],                                         \
92                        [$class: 'BooleanParameterValue',               \
93                          name: 'BuildDocumentation',           \
94                          value: true],                                         \
95                        [$class: 'BooleanParameterValue',               \
96                          name: 'Publish',                              \
97                          value: true],                                         \
98                        [$class: 'BooleanParameterValue',               \
99                          name: 'Silent',                               \
100                          value: true],                                         \
101                ],                                                              \
102                propagate: false
103
104        echo(result.result)
105
106        if(result.result != 'SUCCESS') {
107                sh("wget -q -O - https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/${result.number}/consoleText")
108                error(result.result)
109        }
110}
111
112def trigger_dist(String commitId, String buildNum) {
113        def result = build job: 'Cforall_Distribute_Ref',       \
114                parameters: [                                           \
115                        string(name: 'GitRef', value: commitId),        \
116                        string(name: 'Build' , value: buildNum) \
117                ],                                                              \
118                propagate: false
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
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
139//===========================================================================================================
140//Routine responsible of sending the email notification once the build is completed
141//===========================================================================================================
142
143//Email notification on a full build failure
144def promote_email(boolean success) {
145        node {
146                echo('notifying users')
147
148                def result = success ? "PROMOTE - SUCCESS" : "PROMOTE - FAILURE"
149
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>
155
156        <p>Check console output at ${env.BUILD_URL} to view the results.</p>
157
158        <p>- Status --------------------------------------------------------------</p>
159
160        <p>${result}</p>
161
162        <p>- Logs ----------------------------------------------------------------</p>
163        """
164
165                def email_to = "cforall@lists.uwaterloo.ca"
166
167                //send email notification
168                emailext body: email_body, subject: email_subject, to: email_to, attachLog: !success
169        }
170}
Note: See TracBrowser for help on using the repository browser.