-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
50 lines (48 loc) · 1.43 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
pipeline {
agent any
stages {
stage('prepare build environment') {
steps {
sh('''set +x ; source ./build-env.sh
create-go-build-env.sh''')
}
}
stage('Install dependencies') {
steps {
sh('''set +x ; source ./build-env.sh
glide i''')
}
}
stage('Build') {
steps {
sh('''set +x ; source ./build-env.sh
go build''')
}
}
stage('Tests') {
steps {
sh('''set +x ; source ./build-env.sh
go test forjj-jenkins forjj-jenkins/reportlogs''')
}
}
stage('Deploy') {
when { branch 'master' }
steps {
withCredentials([
usernamePassword(credentialsId: 'github-jenkins-cred', usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN')]) {
withCredentials([
usernamePassword(credentialsId: 'dockerhub-cred', usernameVariable: 'DOCKERHUB_USERNAME', passwordVariable: 'DOCKERHUB_PASSWORD')]) {
sh('''set +x ; source ./build-env.sh
publish-alltags.sh latest
''')
}
}
}
}
}
post {
success {
deleteDir()
}
}
}