-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
272 lines (261 loc) · 9.42 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
pipeline {
agent any
tools {nodejs "InstanceNodeJS"}
stages{
stage('Build Application') {
steps {
sh 'mvn -f db-service/pom.xml clean package'
}
post {
success {
echo "Now Archiving the Artifacts...."
archiveArtifacts artifacts: '**/*.jar'
}
}
}
stage('Install dependencies for Node') {
steps {
dir('Usermanagement_API_Gateway/Backend/') {
checkout scm
sh 'npm install'
}
}
}
stage('Testing NodeJS') {
steps {
dir('Usermanagement_API_Gateway/Backend/') {
checkout scm
sh 'npm test'
}
}
}
stage('build Python Dependencies and runtest for DataAnalysisService') {
steps {
dir('dataanalysis/') {
checkout scm
sh 'pip install -r dataanalysis/requirements.txt'
}
}
}
stage('Testing DataAnalysis Service') {
steps {
dir('dataanalysis/') {
checkout scm
sh 'python test_analysis.py'
}
}
}
stage('build Python Dependencies and runtest for DataModellingService') {
steps {
dir('datamodelling/') {
checkout scm
sh 'pip install -r datamodelling/requirements.txt'
}
}
}
stage('Testing DataModelling Service') {
steps {
dir('datamodelling/') {
checkout scm
sh 'python datamodelling/test_modelling.py'
}
}
}
stage('build Python Dependencies and runtest for DataRetrievalService') {
steps {
dir('dataretrieval/') {
checkout scm
sh 'pip install -r dataretrieval/requirements.txt'
}
}
}
stage('Testing DataRetrieval Service') {
steps {
dir('dataretrieval/') {
checkout scm
sh 'python dataretrieval/test_dataretrieval.py'
}
}
}
stage('Docker image Build') {
steps {
checkout scm
sh '''
sudo apt --assume-yes install docker.io
sudo systemctl start docker
sudo systemctl enable docker
python -m pip uninstall -y urllib3
python -m pip install urllib3==1.22
sudo docker-compose build
'''
}
}
stage('Docker hub Push Image') {
steps {
checkout scm
sh '''
sudo docker login --username=devengers --password=DEVENGERS@2019
sudo docker-compose push
'''
}
}
stage('RabbitMQ Service -- on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd rabbitmq &&
sudo kubectl apply -f rabbit-mqconfig.yaml"
'''
}
}
stage('SQL Service -- on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get upgrade -y &&
sudo apt-get install -y kubectl &&
rm -rf devengers &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers &&
git checkout master &&
cd mysql &&
sudo kubectl apply -f mysql-pv.yaml &&
sudo kubectl apply -f mysql-deployment.yaml"
'''
}
}
stage('PostGres Service -- on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get upgrade -y &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd postgresql &&
sudo kubectl apply -f postgres-storage.yaml &&
sudo kubectl apply -f postgres-deployment.yaml && sudo kubectl apply -f postgres-service.yaml"
'''
}
}
stage('User Management Service --on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd Usermanagement_API_Gateway &&
sudo kubectl delete service datamodel dataanalysis dataretrieval sessionservice ui um-api &&
sudo kubectl delete deployment datamodel dataanalysis dataretrieval sessionservice ui um-api && sudo kubectl apply -f um-apiDeployment.yaml --validate=false"
'''
}
}
stage('UI Service --on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd Frontend &&
sudo kubectl apply -f uiDeployment.yaml --validate=false"
'''
}
}
stage('SessionService --on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd db-service &&
sudo kubectl apply -f dbDeployment.yaml --validate=false"
'''
}
}
stage('Dataretrieval Service --on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd dataretrieval &&
sudo kubectl apply -f dataretrievalDeployment.yaml --validate=false"
'''
}
}
stage('DataModelling Service --on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd datamodelling &&
sudo kubectl apply -f datamodellingDeployment.yaml --validate=false"
'''
}
}
stage('DataAnalysis Service --on Kubernetes Master') {
steps {
sh '''
chmod 400 id_rsa
ssh -o StrictHostKeyChecking=no -i id_rsa ubuntu@149.165.169.178 uptime
ssh -i id_rsa ubuntu@149.165.169.178 "sudo apt install gnupg2 pass -y &&
sudo apt install git -y &&
sudo docker login --username=devengers --password=DEVENGERS@2019 &&
sudo apt-get update &&
rm -rf devengers &&
sudo apt-get install -y kubectl &&
git clone https://github.com/airavata-courses/devengers.git &&
cd devengers && git checkout master && cd dataanalysis &&
sudo kubectl apply -f dataanalysisDeployment.yaml --validate=false"
'''
}
}
}
}