Changes in / [a3e7d34:e24f13a]
- File:
-
- 1 edited
-
Jenkinsfile (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
Jenkinsfile
ra3e7d34 re24f13a 1 1 2 def build() {3 build_stage 'Checkout'4 5 //checkout the source code and clean the repo6 sh 'rm -rf *'7 checkout scm8 9 build_stage 'Build'10 11 //Configure the conpilation (Output is not relevant)12 //Use the current directory as the installation target so nothing13 //escapes the sandbox14 //Also specify the compiler by hand15 def install_dir = pwd tmp: true16 sh "CC=gcc-4.9 CXX=g++-4.9 ./configure --prefix=${install_dir} > /dev/null"17 18 //Compile the project19 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 workspace32 }33 34 def Compiler35 36 def build_stage(String name) {37 def stage_name = "${Compiler} ${name}"38 stage stage_name39 40 status_prefix = stage_name41 }42 2 43 3 node ('master'){ 44 4 45 5 def err = null 46 def sta tus_prefix6 def stage_name 47 7 def log_needed = false 48 8 currentBuild.result = "SUCCESS" 49 9 50 10 try { 51 Compiler = 'gcc-4.9'52 build()53 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 //install doesn't need to be cleaned since prefix uses temporary workspace 54 46 } 55 47 … … 57 49 err = caughtError 58 50 log_needed = true 59 currentBuild.result = "${status_prefix} FAILURE" 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 60 } 61 61 … … 76 76 def project_name = (env.JOB_NAME =~ /(.+)\/.+/)[0][1].toLowerCase() 77 77 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 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] 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 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.