-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathJenkinsfile
108 lines (103 loc) · 4.9 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
pipeline {
agent any
tools {
maven 'M3_8_6'
}
stages {
stage('Zuul') {
when {
anyOf {
changeset "*ZuulBase/**"
expression { currentBuild.previousBuild.result != "SUCCESS"}
}
}
steps {
dir("ZuulBase/"){
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker_hub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh 'docker login -u $USERNAME -p $PASSWORD'
sh "docker build -t ingjavierr/zuul:latest ."
sh 'docker stop zuul || true'
sh 'docker run -d --rm --name zuul -e SPRING_PROFILES_ACTIVE=dev -e HOST_IP_ADDRESS=192.168.1.133 -p 8000:8080 ingjavierr/zuul:latest'
//sh 'docker push ingjavierr/zuul:latest'
}
}
}
}
stage('Eureka') {
when {
anyOf {
changeset "*EurekaBase/**"
expression { currentBuild.previousBuild.result != "SUCCESS"}
}
}
steps {
dir("EurekaBase/"){
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker_hub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh 'docker login -u $USERNAME -p $PASSWORD'
sh "docker build -t ingjavierr/eureka:latest ."
sh 'docker stop eureka || true'
sh 'docker run -d --rm --name eureka -e SPRING_PROFILES_ACTIVE=dev -e HOST_IP_ADDRESS=192.168.1.133 -p 8761:8761 ingjavierr/eureka:latest'
//sh 'docker push ingjavierr/eureka:latest'
}
}
}
}
stage('Ordenes') {
when {
anyOf {
changeset "*ordenes-service/**"
expression { currentBuild.previousBuild.result != "SUCCESS"}
}
}
steps {
dir("ordenes-service/"){
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker_hub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh 'docker login -u $USERNAME -p $PASSWORD'
sh "docker build -t ingjavierr/ordenes-service:latest ."
sh 'docker stop ordenes-service || true'
sh 'docker run -d --rm --name ordenes-service -e SPRING_PROFILES_ACTIVE=dev -e HOST_IP_ADDRESS=192.168.1.133 -p 8020:8020 ingjavierr/ordenes-service:latest'
//sh 'docker push ingjavierr/ordenes-service:latest'
}
}
}
}
stage('Productos') {
when {
anyOf {
changeset "*productos-service/**"
expression { currentBuild.previousBuild.result != "SUCCESS"}
}
}
steps {
dir("productos-service/"){
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker_hub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh 'docker login -u $USERNAME -p $PASSWORD'
sh "docker build -t ingjavierr/productos-service:latest ."
sh 'docker stop productos-service || true'
sh 'docker run -d --rm --name productos-service -e SPRING_PROFILES_ACTIVE=dev -e HOST_IP_ADDRESS=192.168.1.133 -p 8030:8030 ingjavierr/productos-service:latest'
//sh 'docker push ingjavierr/productos-service:latest'
}
}
}
}
stage('Usuarios') {
when {
anyOf {
changeset "*usuarios-service/**"
expression { currentBuild.previousBuild.result != "SUCCESS"}
}
}
steps {
dir("usuarios-service/"){
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'docker_hub', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
sh 'docker login -u $USERNAME -p $PASSWORD'
sh "docker build -t ingjavierr/usuarios-service:latest ."
sh 'docker stop usuarios-service || true'
sh 'docker run -d --rm --name usuarios-service -e SPRING_PROFILES_ACTIVE=dev -e HOST_IP_ADDRESS=192.168.1.133 -p 8010:8010 ingjavierr/usuarios-service:latest'
//sh 'docker push ingjavierr/usuarios-service:latest'
}
}
}
}
}
}