source: Jenkins/FullBuild @ 956910d

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

Fix syntax of FullBuild? script

  • 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        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
33                promote_email(true)
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
48                promote_email(false)
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
62def trigger_build(String cc, String arch, boolean new_ast) {
63        def result = build job: 'Cforall/master',               \
64                parameters: [                                           \
65                        [$class: 'StringParameterValue',                \
66                          name: 'Compiler',                             \
67                          value: cc],                                   \
68                        [$class: 'StringParameterValue',                \
69                          name: 'Architecture',                         \
70                          value: arch],                                 \
71                        [$class: 'BooleanParameterValue',               \
72                          name: 'NewAST',                               \
73                          value: new_ast],                              \
74                        [$class: 'BooleanParameterValue',               \
75                          name: 'RunAllTests',                          \
76                          value: true],                                         \
77                        [$class: 'BooleanParameterValue',               \
78                          name: 'RunBenchmark',                         \
79                          value: true],                                         \
80                        [$class: 'BooleanParameterValue',               \
81                          name: 'BuildDocumentation',           \
82                          value: true],                                         \
83                        [$class: 'BooleanParameterValue',               \
84                          name: 'Publish',                              \
85                          value: true],                                         \
86                        [$class: 'BooleanParameterValue',               \
87                          name: 'Silent',                               \
88                          value: true],                                         \
89                ],                                                              \
90                propagate: false
91
92        echo(result.result)
93
94        if(result.result != 'SUCCESS') {
95                sh("wget -q -O - http://localhost:8084/jenkins/job/Cforall/job/master/${result.number}/consoleText")
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
121def promote_email(boolean success) {
122        echo('notifying users')
123
124        def result = success ? "PROMOTE - SUCCESS" : "PROMOTE - FAILURE"
125
126        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
127        //Configurations for email format
128        def email_subject = "[cforall git][${result}]"
129        def email_body = """<p>This is an automated email from the Jenkins build machine. It was
130generated following the result of the C\u2200 nightly build.</p>
131
132<p>Check console output at ${env.BUILD_URL} to view the results.</p>
133
134<p>- Status --------------------------------------------------------------</p>
135
136<p>${result}</p>
137
138<p>- Performance ---------------------------------------------------------</p>
139
140<img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=0" >
141<img src="https://cforall.uwaterloo.ca/jenkins/job/Cforall/job/master/plot/Compilation/getPlot?index=1" >
142
143<p>- Logs ----------------------------------------------------------------</p>
144"""
145
146        def email_to = "cforall@lists.uwaterloo.ca"
147
148        //send email notification
149        emailext body: email_body, subject: email_subject, to: email_to, attachLog: !success
150}
Note: See TracBrowser for help on using the repository browser.