-
Notifications
You must be signed in to change notification settings - Fork 7
/
Jenkinsfile
73 lines (68 loc) · 1.77 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
65
66
67
68
69
70
71
72
73
pipeline {
agent {
node {
label 'go'
}
}
environment {
DOCKERHUB_CREDENTIAL_ID = 'dockerhub-id'
}
stages {
stage('checkout scm ') {
steps {
checkout(scm)
}
}
stage('prepare') {
steps {
container('go') {
sh 'go get github.com/cpuguy83/go-md2man'
sh 'yum install distgen -y'
}
}
}
stage('nodejs4 test') {
steps {
container('go') {
sh '''git submodule update --init
make VERSIONS="4" BASE_IMAGE_NAME="nodejs" test'''
}
}
}
stage('nodejs6 test') {
steps {
container('go') {
sh '''git submodule update --init
make VERSIONS="6" BASE_IMAGE_NAME="nodejs" test'''
}
}
}
stage('nodejs8 test') {
steps {
container('go') {
sh '''git submodule update --init
make VERSIONS="8" BASE_IMAGE_NAME="nodejs" test'''
}
}
}
stage('push to dockerhub'){
when {
branch 'master'
}
steps{
container('go'){
withCredentials([usernamePassword(passwordVariable : 'DOCKER_PASSWORD' ,usernameVariable : 'DOCKER_USERNAME' ,credentialsId : "$DOCKERHUB_CREDENTIAL_ID" ,)]) {
sh 'echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin'
}
sh '''docker tag kubespheredev/nodejs-4-centos7 kubespheredev/nodejs-4-centos7:2.1.0
docker tag kubespheredev/nodejs-6-centos7 kubespheredev/nodejs-6-centos7:2.1.0
docker tag kubespheredev/nodejs-8-centos7 kubespheredev/nodejs-8-centos7:2.1.0
'''
sh 'docker push kubespheredev/nodejs-4-centos7'
sh 'docker push kubespheredev/nodejs-6-centos7'
sh 'docker push kubespheredev/nodejs-8-centos7'
}
}
}
}
}