-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (61 loc) · 1.56 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
pipeline {
agent {
dockerfile {
label 'vetsgov-general-purpose'
}
}
environment {
BABEL_CACHE_PATH = '${env.WORKSPACE}'
BABEL_DISABLE_CACHE = 1
NODE_ENV = 'production'
}
stages {
stage('setup') {
steps {
sh 'yarn install --production=false'
sh 'yarn bootstrap'
}
}
stage('test, and build') {
steps {
parallel (
/*
TODO: fix the bootstrapping and add this back
'lint': {
sh 'npm run lint'
},
*/
'test': {
sh 'NODE_ENV=test npm run test'
},
'build': {
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'va-bot',
usernameVariable: 'USERNAME',
passwordVariable: 'TOKEN'
]]) {
sh "GITHUB_API_KEY=${env.TOKEN} npm run build"
}
}
)
}
}
stage('deploy') {
when { branch 'master' }
steps {
sh 'git config --global user.email [email protected]'
sh 'git config --global user.name va-bot'
sh 'git config --global credential.helper "/bin/bash ' + env.WORKSPACE + '/scripts/credential-helper.sh"'
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'va-bot',
usernameVariable: 'GIT_USERNAME',
passwordVariable: 'GIT_PASSWORD'
]]) {
sh "GITHUB_API_KEY=${env.GIT_PASSWORD} npm run deploy"
}
}
}
}
}