-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathJenkinsfile
163 lines (124 loc) · 5.2 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
node('nimble-jenkins-slave') {
// -----------------------------------------------
// --------------- Staging Branch ----------------
// -----------------------------------------------
if (env.BRANCH_NAME == 'staging') {
stage('Clone and Update') {
git(url: 'https://github.com/nimble-platform/frontend-service.git', branch: env.BRANCH_NAME)
}
stage('Build Application - FMP') {
sh 'mvn clean install -Denv=fmp-staging'
}
stage('Build Docker - FMP') {
sh 'docker build -t nimbleplatform/frontend-service:fmp-staging ./target'
}
stage('Push Docker - FMP') {
sh 'docker push nimbleplatform/frontend-service:fmp-staging'
}
stage('Deploy - FMP') {
sh 'ssh staging "cd /srv/nimble-staging/ && ./run-staging.sh restart-single frontend-service-fmp"'
}
stage('Build Application - MVP') {
sh 'mvn clean install -Denv=staging'
}
stage('Build Docker - MVP') {
sh 'docker build -t nimbleplatform/frontend-service:staging ./target'
}
stage('Push Docker - MVP') {
sh 'docker push nimbleplatform/frontend-service:staging'
}
stage('Deploy - MVP') {
sh 'ssh staging "cd /srv/nimble-staging/ && ./run-staging.sh restart-single frontend-service"'
}
stage('Build Application - EFAC') {
sh 'mvn clean install -Denv=efac-staging'
}
stage('Build Docker - EFAC') {
sh 'docker build -t nimbleplatform/frontend-service:efac-staging ./target'
}
stage('Push Docker - EFAC') {
sh 'docker push nimbleplatform/frontend-service:efac-staging'
}
stage('Deploy - EFAC') {
sh 'ssh staging "cd /srv/nimble-staging/ && ./run-staging.sh restart-single frontend-service-efactory"'
}
stage('Build Application - Eco House') {
sh 'mvn clean install -Denv=ecohouse'
}
stage('Build Docker - Eco House') {
sh 'docker build -t nimbleplatform/frontend-service:ecohouse ./target'
}
stage('Push Docker - Eco House') {
sh 'docker push nimbleplatform/frontend-service:ecohouse'
}
}
// -----------------------------------------------
// ---------------- Master Branch ----------------
// -----------------------------------------------
if (env.BRANCH_NAME == 'master') {
stage('Clone and Update') {
git(url: 'https://github.com/nimble-platform/frontend-service.git', branch: env.BRANCH_NAME)
}
stage('Build Application') {
sh 'mvn clean install -Denv=prod'
}
}
// -----------------------------------------------
// ---------------- Release Tags -----------------
// -----------------------------------------------
if( env.TAG_NAME ==~ /^\d+.\d+.\d+$/) {
stage('Clone and Update') {
git(url: 'https://github.com/nimble-platform/frontend-service.git', branch: 'master')
}
stage('Set version') {
sh 'mvn versions:set -DnewVersion=' + env.TAG_NAME
}
stage('Build Application - MVP') {
sh 'mvn clean install -Denv=prod'
}
stage('Build Docker - MVP') {
sh 'docker build -t nimbleplatform/frontend-service ./target'
}
stage('Push Docker - MVP') {
sh 'docker push nimbleplatform/frontend-service:latest'
sh 'docker tag nimbleplatform/frontend-service:latest nimbleplatform/frontend-service:' + env.TAG_NAME
sh 'docker push nimbleplatform/frontend-service:' + env.TAG_NAME
}
stage('Deploy - MVP') {
sh 'ssh nimble "cd /data/deployment_setup/prod/ && export COMPOSE_HTTP_TIMEOUT=600 && sudo ./run-prod.sh restart-single frontend-service"'
}
stage('Build Application - FMP') {
sh 'mvn clean install -Denv=fmp'
}
stage('Build Docker - FMP') {
sh 'docker build -t nimbleplatform/frontend-service:fmp ./target'
}
stage('Push Docker - FMP') {
sh 'docker push nimbleplatform/frontend-service:fmp'
}
/*stage('Deploy - FMP') {
sh 'ssh fmp-prod "cd /srv/nimble-fmp/ && ./run-fmp-prod.sh restart-single frontend-service"'
}*/
stage('Build Application - Efac') {
sh 'mvn clean install -Denv=efac'
}
stage('Build Docker - Efac') {
sh 'docker build -t nimbleplatform/frontend-service:efac ./target'
}
stage('Push Docker - Efac') {
sh 'docker push nimbleplatform/frontend-service:efac'
}
stage('Deploy - Efac') {
sh 'ssh efac-prod "cd /srv/nimble-efac/ && ./run-efac-prod.sh restart-single frontend-service"'
}
stage('Build Application - EFAC-SME') {
sh 'mvn clean install -Denv=efac-sme'
}
stage('Build Docker - EFAC-SME') {
sh 'docker build -t nimbleplatform/frontend-service:efac-sme ./target'
}
stage('Push Docker - EFAC-SME') {
sh 'docker push nimbleplatform/frontend-service:efac-sme'
}
}
}