-
Notifications
You must be signed in to change notification settings - Fork 10
/
Jenkinsfile
142 lines (130 loc) · 4.34 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
pipeline {
agent {
kubernetes{
label 'jenkins-slave'
}
}
options {
skipStagesAfterUnstable()
}
environment{
DOCKER_USERNAME = credentials('DOCKER_USERNAME')
DOCKER_PASSWORD = credentials('DOCKER_PASSWORD')
}
stages {
stage('docker login') {
steps{
sh(script: """
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
""", returnStdout: true)
}
}
stage('python server docker build') {
steps{
sh script: '''
#!/bin/bash
cd ./python
docker build . --network host -t manug2018/python:${BUILD_NUMBER}
'''
}
}
stage('python server docker push') {
steps{
sh(script: """
docker push manug2018/python:${BUILD_NUMBER}
""")
}
}
stage('calc-service build') {
steps{
withMaven(
// Maven installation declared in the Jenkins "Global Tool Configuration"
maven: 'Maven_3.6.3', // (1)
// Use `$WORKSPACE/.repository` for local repository folder to avoid shared repositories
mavenLocalRepo: '.repository', // (2)
// Maven settings.xml file defined with the Jenkins Config File Provider Plugin
// We recommend to define Maven settings.xml globally at the folder level using
// navigating to the folder configuration in the section "Pipeline Maven Configuration / Override global Maven configuration"
// or globally to the entire master navigating to "Manage Jenkins / Global Tools Configuration"
// mavenSettingsConfig: 'my-maven-settings' // (3)
){
sh script: '''
#!/bin/bash
cd ./calc-service
mvn clean install
'''
}
}
}
stage('calc-service docker build') {
steps{
sh script: '''
#!/bin/bash
cd ./calc-service
docker build . --network host -t manug2018/calc-service:${BUILD_NUMBER}
'''
}
}
stage('calc-service docker push') {
steps{
sh(script: """
docker push manug2018/calc-service:${BUILD_NUMBER}
""")
}
}
stage('deploy service') {
steps{
sh script: '''
#!/bin/bash
chmod +x ./deploy/*.sh
./deploy/installKubeCtl.sh
./deploy/startCalcService.sh
#starting calc service script also stores calc service url in file calc_service_url.txt
./deploy/startPythonServer.sh
'''
}
}
stage('html-ui docker build') {
steps{
sh script: '''
#!/bin/bash
chmod +x ./html-ui/*.sh
./html-ui/processHtmlFile.sh
cd ./html-ui
docker build . --network host -t manug2018/html-ui:${BUILD_NUMBER}
'''
}
}
stage('html-ui docker push') {
steps{
sh(script: """
docker push manug2018/html-ui:${BUILD_NUMBER}
""")
}
}
stage('deploy html-ui') {
steps{
sh script: '''
#!/bin/bash
./deploy/startHtml.sh
'''
}
}
stage('regression testpack') {
steps{
withMaven(
maven: 'Maven_3.6.3', // (1)
mavenLocalRepo: '.repository', // (2)
){
sh script: '''
#!/bin/bash
#retieve calc service url from file calc_service_url.txt
aws_url=`cat calc_service_url.txt`
cd ./regression-tests
mvn clean verify -Dtest.calc.service.url="http://${aws_url}"
'''
}
}
}
}
}