github.com/turingchain2020/turingchain@v1.1.21/Jenkinsfile (about) 1 pipeline { 2 agent any 3 4 environment { 5 GOPATH = "${WORKSPACE}" 6 PROJ_DIR = "${WORKSPACE}/src/gitlab.__officeSite__/turingchain/turingchain" 7 } 8 9 options { 10 timeout(time: 2,unit: 'HOURS') 11 retry(1) 12 timestamps() 13 gitLabConnection('gitlab33') 14 gitlabBuilds(builds: ['check', 'build', 'test', 'deploy']) 15 checkoutToSubdirectory "src/gitlab.__officeSite__/turingchain/turingchain" 16 } 17 18 stages { 19 stage('check') { 20 steps { 21 dir("${PROJ_DIR}"){ 22 gitlabCommitStatus(name: 'check'){ 23 sh "make auto_ci branch=${env.gitlabSourceBranch}" 24 } 25 } 26 } 27 } 28 29 stage('build') { 30 steps { 31 dir("${env.PROJ_DIR}"){ 32 gitlabCommitStatus(name: 'build'){ 33 sh 'make checkgofmt' 34 sh 'make linter' 35 } 36 } 37 } 38 } 39 40 stage('test'){ 41 agent { 42 docker{ 43 image 'suyanlong/turingchain-run:latest' 44 } 45 } 46 47 environment { 48 GOPATH = "${WORKSPACE}" 49 PROJ_DIR = "${WORKSPACE}/src/gitlab.__officeSite__/turingchain/turingchain" 50 } 51 52 steps { 53 dir("${env.PROJ_DIR}"){ 54 gitlabCommitStatus(name: 'test'){ 55 sh 'make test' 56 //sh 'export CC=clang-5.0 && make msan' 57 } 58 } 59 } 60 } 61 62 stage('deploy') { 63 steps { 64 dir("${PROJ_DIR}"){ 65 gitlabCommitStatus(name: 'deploy'){ 66 sh 'make build_ci' 67 sh "make autotest_ci proj=${env.BUILD_NUMBER}" 68 sh "cd build && mkdir ${env.BUILD_NUMBER} && cp ci/* ${env.BUILD_NUMBER} -r && cp turingchain* Dockerfile* docker* *.sh ${env.BUILD_NUMBER}/ && cd ${env.BUILD_NUMBER}/ && ./docker-compose-pre.sh run ${env.BUILD_NUMBER} all " 69 } 70 } 71 } 72 73 post { 74 always { 75 dir("${PROJ_DIR}"){ 76 sh "cd build/${env.BUILD_NUMBER} && ./docker-compose-pre.sh down ${env.BUILD_NUMBER} all && cd .. && rm -rf ${env.BUILD_NUMBER} && cd .. && make clean " 77 } 78 } 79 } 80 } 81 } 82 83 post { 84 always { 85 echo 'One way or another, I have finished' 86 // clean up our workspace 87 deleteDir() 88 } 89 90 success { 91 echo 'I succeeeded!' 92 echo "email user: ${gitlabUserEmail}" 93 mail to: "${gitlabUserEmail}", 94 subject: "Successed Pipeline: ${currentBuild.fullDisplayName}", 95 body: "this is success with ${env.BUILD_URL}" 96 } 97 98 failure { 99 echo 'I failed ' 100 echo "email user: ${gitlabUserEmail}" 101 mail to: "${gitlabUserEmail}", 102 subject: "Failed Pipeline: ${currentBuild.fullDisplayName}", 103 body: "Something is wrong with ${env.BUILD_URL}" 104 } 105 } 106 }