source: Jenkinsfile @ 7359098

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 7359098 was 7359098, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

fixed the syntax of pwd call in Jenkinsfile

  • Property mode set to 100644
File size: 2.3 KB
Line 
1
2
3node ('master'){
4
5        def err = null
6        def stage_name
7        def log_needed = false
8        currentBuild.result = "SUCCESS"
9
10        try {
11
12                stage 'Checkout'
13
14                        //checkout the source code and clean the repo
15                        checkout scm
16                        sh 'git clean -dfq'
17
18                stage 'Build'
19
20                        stage_name = 'Build'
21
22                        //Clean the directory (Output is not relevant)
23                        sh 'make clean > /dev/null'
24
25                        //Configure the conpilation (Output is not relevant)
26                        //Use the current directory as the installation target so nothing
27                        //escapes the sandbox
28                        //Also specify the compiler by hand
29                        def install_dir = pwd tmp: true
30                        sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"
31
32                        //Compile the project
33                        sh 'make -j 8 install'
34
35                stage 'Test'
36
37                        stage_name = 'Test'
38
39                        dir ('src/examples') {
40                                sh './runTests.sh'
41                        }
42
43                stage 'Cleanup'
44
45                        email("SUCCESS", false)
46        }
47
48        catch (Exception caughtError) {
49                err = caughtError
50                log_needed = true
51                currentBuild.result = "FAILURE"
52
53                switch(stage_name) {
54                        case 'Test' :
55                                currentBuild.result = "TEST FAILURE"
56                                break
57                        default :
58                                break
59                }
60        }
61
62        finally {
63                //Send email with final results
64                email(currentBuild.result, log_needed)
65
66                /* Must re-throw exception to propagate error */
67                if (err) {
68                        throw err
69                }
70        }
71}
72
73def email(String status, boolean log) {
74        //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line
75        //Configurations for email format
76        def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase()
77
78        def email_subject = "[${project_name} git] UNNAMED PROJECT branch ${env.BRANCH_NAME} - Build # ${env.BUILD_NUMBER} - ${status}!"
79        def email_body = """    This is an automated email from the Jenkins build machine. It was
80        generated because of a git hooks/post-receive script following
81        a ref change was pushed to the repository containing
82        the project "UNNAMED PROJECT".
83
84        The branch ${env.BRANCH_NAME} has been updated.
85
86        Check console output at ${env.BUILD_URL} to view the results."""
87
88        // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
89        // def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1]
90        def email_to = "pabuhr@uwaterloo.ca, rschlunt@uwaterloo.ca, a3moss@uwaterloo.ca, tdelisle@uwaterloo.ca, brice.dobry@huawei.com"
91
92        //send email notification
93        emailext body: email_body, subject: email_subject, to: email_to, attachLog: log
94}
Note: See TracBrowser for help on using the repository browser.