-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
183 lines (156 loc) · 3.55 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
node()
{
try
{
String str = "devejjlop"
stage 'Select Build type1'
//Feature branch added
if ("${env.JOB_NAME}" == 'pileline-abdul')
{
print "Building the abdul branch "
/***Calling the function developBranch if develop branch is being built***/
developBranch()
}
else if ( str == 'master')
{
print "Building the master branch "
/***Calling the function masterBranch if master branch is being built***/
masterBranch()
}
else
{
print "Building the feature branch"
/***Calling the function featureBranch if feature branch is being built***/
featureBranch()
}
}
catch(e)
{
currentBuild.result = "FAILED"
//notifyBuild(currentBuild.result)
throw(e)
}
finally
{
echo "echo final block"
}
}
def developBranch()
{
/***Download code from stash***/
stage ("Download code")
{
download_stash_code()
}
/***Perform maven clean***/
stage ("Clean")
{
clean()
}
/***Perform maven mUnit tests***/
stage ("mUnit Tests")
{
//munit_tests()
}
/***Publish the coverage report and junit reports***/
stage ("Publish Reports")
{
publish_junit()
publish_html()
}
/***Create zip package from the source code and push it to artifactory***/
stage ("Package & Publish")
{
package_publish_artifactory()
}
}
def masterBranch()
{
print "inside masterBranch() "
/***Download code from stash***/
stage ("Download Code")
{
download_stash_code()
}
/***Perform maven clean***/
stage ("Clean")
clean()
/***Perform maven mUnit tests***/
stage ("mUnit Tests"){
//munit_tests()
}
/***Publish the coverage report and junit reports***/
stage ("Publish Reports"){
publish_junit()
publish_html()
}
/***Create zip package from the source code and push it to artifactory***/
stage ("Package & Publish"){
package_publish_artifactory_master()
}
}
def featureBranch()
{
/***Download code from stash***/
stage ('Download Code'){
download_stash_code()
}
/***Perform maven clean***/
stage (" Clean")
{
clean()
}
/***Perform maven mUnit tests***/
stage ("mUnit Tests"){
//munit_tests()
}
/***SoapUI Integration Tests***/
stage ("SoupUI Integration Testing")
{
download_soapUi_code()
}
/***Publish the coverage report and junit reports***/
stage ("Publish Reports"){
publish_junit()
publish_html()
}
/***Create zip package from the source code and push it to artifactory***/
stage ("Package & Publish")
{
package_publish_artifactory_master()
}
}
/***Function definitions start from here***/
/***Function definition for downloading code from Stash to workspace in jenkins***/
def download_stash_code()
{
print "inside download_stash_code() "
}
/***Function definition to perform maven clean***/
def clean()
{
print "inside clean() "
}
def publish_junit()
{
print "inside publish_junit()"
}
def publish_html()
{
print "inside publish_html()"
}
/***Function definition to push the artifacts to artifactory***/
def package_publish_artifactory()
{
print "inside package_publish_artifactory()"
}
/***Download SoapUI Scripts from the Stash and executing them***/
def download_soapUi_code()
{
print "download_soapUi_code()"
}
/***Function definition to push the artifacts to artifactory for the master branch, performs maven release***/
def package_publish_artifactory_master()
{
print "inside package_publish_artifactory_master()"
}