Changes in / [e24f13a:a3e7d34]
- File:
-
- 1 edited
-
Jenkinsfile (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
re24f13a ra3e7d34 1 1 2 def build() { 3 build_stage 'Checkout' 4 5 //checkout the source code and clean the repo 6 sh 'rm -rf *' 7 checkout scm 8 9 build_stage 'Build' 10 11 //Configure the conpilation (Output is not relevant) 12 //Use the current directory as the installation target so nothing 13 //escapes the sandbox 14 //Also specify the compiler by hand 15 def install_dir = pwd tmp: true 16 sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null" 17 18 //Compile the project 19 sh 'make -j 8 install' 20 21 build_stage 'Test' 22 23 status_prefix = 'Test' 24 25 dir ('src/examples') { 26 sh './runTests.sh' 27 } 28 29 build_stage 'Cleanup' 30 31 //install doesn't need to be cleaned since prefix uses temporary workspace 32 } 33 34 def Compiler 35 36 def build_stage(String name) { 37 def stage_name = "${Compiler} ${name}" 38 stage stage_name 39 40 status_prefix = stage_name 41 } 2 42 3 43 node ('master'){ 4 44 5 45 def err = null 6 def sta ge_name46 def status_prefix 7 47 def log_needed = false 8 48 currentBuild.result = "SUCCESS" 9 49 10 50 try { 51 Compiler = 'gcc-4.9' 52 build() 11 53 12 stage 'Checkout'13 14 //checkout the source code and clean the repo15 checkout scm16 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 nothing27 //escapes the sandbox28 //Also specify the compiler by hand29 def install_dir = pwd tmp: true30 sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"31 32 //Compile the project33 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 //install doesn't need to be cleaned since prefix uses temporary workspace46 54 } 47 55 … … 49 57 err = caughtError 50 58 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 } 59 currentBuild.result = "${status_prefix} FAILURE" 60 60 } 61 61 … … 76 76 def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() 77 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 was80 generated because of a git hooks/post-receive script following81 a ref change was pushed to the repository containing82 the project "UNNAMED PROJECT".78 def email_subject = "[${project_name} git][BUILD - ${status}!]Build # ${env.BUILD_NUMBER} - ${env.BRANCH_NAME}" 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 83 84 The branch ${env.BRANCH_NAME} has been updated.84 The branch ${env.BRANCH_NAME} has been updated. 85 85 86 Check console output at ${env.BUILD_URL} to view the results."""86 Check console output at ${env.BUILD_URL} to view the results.""" 87 87 88 88 // def config = new File('/u/cforall/software/cfa/cfa-cc/config').text
Note:
See TracChangeset
for help on using the changeset viewer.