Move environment declaration to stage blocks
[cacert-boardvoting.git] / Jenkinsfile
1 #!groovy
2 pipeline {
3 agent any
4
5 environment {
6 GOPATH = "${pwd(tmp: true)}/gocode"
7 }
8
9 stages {
10 stage('Fetch go dependencies') {
11 environment {
12 BUILDDIR = "${GOPATH}/src/git.cacert.org/cacert-boardvoting"
13 }
14 steps {
15 sh "rm -rf '${GOPATH}/src/git.cacert.org' ; mkdir -p '${GOPATH}/src/git.cacert.org'"
16 sh "ln -s '${pwd()}' '${BUILDDIR}'"
17 dir("${BUILDDIR}") {
18 sh "pwd ; go get -u github.com/golang/dep/cmd/dep && '${GOPATH}/bin/dep' ensure -v"
19 }
20 }
21 }
22 stage('Build') {
23 environment {
24 BUILDDIR = "${GOPATH}/src/git.cacert.org/cacert-boardvoting"
25 }
26 steps {
27 dir("${BUILDDIR}") {
28 sh 'make clean && make'
29 }
30 }
31 }
32 stage('Create build output') {
33 steps {
34 archiveArtifacts artifacts: 'cacert-boardvoting,templates/**,db/**,config.yaml.example,static/**'
35 }
36 }
37 }
38 }