source: Jenkins/FullBuild @ cb2e8ce

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since cb2e8ce was cb2e8ce, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

fixed machine type issue in tests, tentative fix for full build

  • Property mode set to 100644
File size: 3.6 KB
Line 
1#!groovy
2
3//===========================================================================================================
4// Main compilation routines
5//===========================================================================================================
6
7def trigger_build(String arch) {
8        def result = build job: 'Cforall/master',               \
9                parameters: [                                           \
10                        [$class: 'BooleanParameterValue',               \
11                          name: 'isFullBuild',                          \
12                          value: true],                                         \
13                        [$class: 'StringParameterValue',                \
14                          name: 'buildArchitecture',                    \
15                          value: arch]                                  \
16                ]
17
18        echo(result.result)
19        echo(result.absoluteUrl)
20}
21
22def push_build() {
23        //Don't use the build_stage function which outputs the compiler
24        stage 'Push'
25
26                status_prefix = 'Push'
27
28                def out_dir = pwd tmp: true
29                sh "mkdir -p ${out_dir}"
30
31                //checkout the code to make sure this is a valid git repo
32                checkout scm
33
34                //parse git logs to find what changed
35                sh "git remote > ${out_dir}/GIT_REMOTE"
36                git_remote = readFile("${out_dir}/GIT_REMOTE")
37                remoteDoLangExists = git_remote.contains("DoLang")
38
39                if( !remoteDoLangExists ) {
40                        sh 'git remote add DoLang git@gitlab.do-lang.org:internal/cfa-cc.git'
41                }
42
43                sh "git push DoLang ${gitRefNewValue}:master"
44}
45
46//===========================================================================================================
47// Main loop of the compilation
48//===========================================================================================================
49
50node ('master') {
51        try {
52                //Prevent the build from exceeding 30 minutes
53                timeout(60) {
54
55                        //Wrap build to add timestamp to command line
56                        wrap([$class: 'TimestamperBuildWrapper']) {
57
58                                stage 'Build'
59
60                                        results = [null, null]
61
62                                        parallel (
63                                                x64: {
64                                                        trigger_build('64-bit')
65                                                },
66                                                x32: {
67                                                        trigger_build('32-bit')
68                                                }
69                                        )
70
71                                //Push latest changes to do-lang repo
72                                push_build()
73                        }
74                }
75        }
76
77        //If an exception is caught we need to change the status and remember to
78        //attach the build log to the email
79        catch (Exception caughtError) {
80                //rethrow error later
81                err = caughtError
82
83                //Store the result of the build log
84                currentBuild.result = "${status_prefix} FAILURE".trim()
85
86                //Send email to notify the failure
87                promote_email(currentBuild.result)
88        }
89
90        finally {
91                //Must re-throw exception to propagate error
92                if (err) {
93                        throw err
94                }
95        }
96}
97//===========================================================================================================
98//Routine responsible of sending the email notification once the build is completed
99//===========================================================================================================
100
101//Email notification on a full build failure
102def promote_email(String status) {
103        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
104        //Configurations for email format
105        def email_subject = "[cforall git][PROMOTE - FAILURE]"
106        def email_body = """This is an automated email from the Jenkins build machine. It was
107generated because of a git hooks/post-receive script following
108a ref change was pushed to the repository containing
109the project "UNNAMED PROJECT".
110
111Check console output at ${env.BUILD_URL} to view the results.
112
113- Status --------------------------------------------------------------
114
115PROMOTE FAILURE - ${status}
116"""
117
118        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
119
120        //send email notification
121        emailext body: email_body, subject: email_subject, to: email_to, attachLog: true
122}
Note: See TracBrowser for help on using the repository browser.