source:
Jenkinsfile@
c78e410
| Last change on this file since c78e410 was c78e410, checked in by , 10 years ago | |
|---|---|
|
|
| File size: 1.3 KB | |
| Rev | Line | |
|---|---|---|
| [c9d651d] | 1 | |
| 2 | ||
| [c78e410] | 3 | //checkout the source code and clean the repo |
| [7aebc62] | 4 | stage 'Checkout' |
| 5 | node { | |
| [f2b977a] | 6 | checkout scm |
| [1e34653] | 7 | sh 'git clean -dfq' |
| [7aebc62] | 8 | } |
| [23a14d86] | 9 | |
| [7aebc62] | 10 | |
| 11 | stage 'Build' | |
| 12 | node ('master'){ | |
| [23a14d86] | 13 | //configure the conpilation |
| [d3d0069] | 14 | try { |
| [c78e410] | 15 | sh 'make clean > /dev/null' |
| [e8a22a7] | 16 | sh 'CC=gcc-4.9 CXX=g++-4.9 ./configure > /dev/null' |
| [ed091cd] | 17 | sh 'make -j 8' |
| [1e34653] | 18 | email("SUCCESS", false) |
| [d3d0069] | 19 | } catch (Exception e) { |
| [1e34653] | 20 | email("FAILURE", true) |
| [e8a22a7] | 21 | throw e; |
| [d3d0069] | 22 | } |
| [7aebc62] | 23 | } |
| [f2b977a] | 24 | |
| [19ad15b] | 25 | def email(String status, boolean log) { |
| [e8a22a7] | 26 | //Since tokenizer doesn't work, figure stuff out from the environnement variables and command line |
| 27 | //Configurations for email format | |
| 28 | def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() | |
| 29 | ||
| [bb5a0bb] | 30 | def email_subject = "[${project_name} git] UNNAMED PROJECT branch ${env.BRANCH_NAME} - Build # ${env.BUILD_NUMBER} - ${status}!" |
| [ed091cd] | 31 | def email_body = """ This is an automated email from the Jenkins build machine. It was |
| [e8a22a7] | 32 | generated because of a git hooks/post-receive script following |
| 33 | a ref change was pushed to the repository containing | |
| 34 | the project "UNNAMED PROJECT". | |
| 35 | ||
| [ed091cd] | 36 | The branch ${env.BRANCH_NAME} has been updated. |
| [e8a22a7] | 37 | |
| 38 | Check console output at ${env.BUILD_URL} to view the results.""" | |
| 39 | ||
| [71b7843] | 40 | def config = new File('/u/cforall/software/cfa/cfa-cc/config').text |
| 41 | def email_to = (config =~ /mailinglist ?= ?(.+)/)[0][1] | |
| [e8a22a7] | 42 | |
| 43 | //send email notification | |
| [1e34653] | 44 | emailext body: email_body, subject: email_subject, to: email_to, attachLog: log |
| [e8a22a7] | 45 | } |
Note:
See TracBrowser
for help on using the repository browser.