Skip to content

Commit c6095c9

Browse files
committed
Fix validation checks for ss and netstat - all remaining stages fixed. Issue #400
1 parent 5862e50 commit c6095c9

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

Jenkinsfile

+28-28
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ pipeline {
3333
sh 'php -v'
3434
sh 'cat /etc/os-release'
3535
sh 'echo "Checking with netstat..."'
36-
def output_netstat = sh '/opt/bitnami/apache/bin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
36+
def output_netstat = sh(script: "/opt/bitnami/apache/bin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
3737
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
3838
error "Output validation failed"
3939
}
4040
sh 'echo "installing iproute2 which contains ss..."'
4141
sh 'install_packages iproute2'
4242
sh 'echo "Checking with ss..."'
43-
def output_ss = sh '/opt/bitnami/apache/bin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
43+
def output_ss = sh(script: "/opt/bitnami/apache/bin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
4444
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
4545
error "Output validation failed"
4646
}
@@ -66,7 +66,7 @@ pipeline {
6666
sh 'cat /etc/os-release'
6767
sh 'echo "Oracle Linux defaults to ss"'
6868
sh 'echo "Checking with ss..."'
69-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
69+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
7070
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
7171
error "Output validation failed"
7272
}
@@ -75,7 +75,7 @@ pipeline {
7575
sh 'echo "installing net-tools" which includes netstat'
7676
sh 'yum -y install net-tools'
7777
sh 'echo "Testing with netstat..."'
78-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
78+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
7979
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
8080
error "Output validation failed"
8181
}
@@ -101,7 +101,7 @@ pipeline {
101101
sh 'cat /etc/os-release'
102102
sh 'echo "Oracle Linux defaults to ss"'
103103
sh 'echo "Checking with ss..."'
104-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
104+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
105105
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
106106
error "Output validation failed"
107107
}
@@ -110,7 +110,7 @@ pipeline {
110110
sh 'echo "installing net-tools" which includes netstat'
111111
sh 'yum -y install net-tools'
112112
sh 'echo "Testing with netstat..."'
113-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
113+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
114114
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
115115
error "Output validation failed"
116116
}
@@ -134,14 +134,14 @@ pipeline {
134134
sh 'apachectl configtest'
135135
sh 'cat /etc/os-release'
136136
sh 'echo "Checking with netstat..."'
137-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
137+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
138138
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
139139
error "Output validation failed"
140140
}
141141
sh 'echo "Installing iproute which contains ss command"'
142142
sh 'yum -y install iproute'
143143
sh 'echo "Checking with ss..."'
144-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
144+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
145145
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
146146
error "Output validation failed"
147147
}
@@ -165,14 +165,14 @@ pipeline {
165165
sh 'apachectl configtest'
166166
sh 'cat /etc/os-release'
167167
sh 'echo "Checking with netstat..."'
168-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
168+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
169169
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
170170
error "Output validation failed"
171171
}
172172
sh 'echo "Installing iproute which contains ss command"'
173173
sh 'yum -y install iproute'
174174
sh 'echo "Checking with ss..."'
175-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
175+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
176176
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
177177
error "Output validation failed"
178178
}
@@ -197,14 +197,14 @@ pipeline {
197197
sh 'apachectl configtest'
198198
sh 'cat /etc/os-release'
199199
sh 'echo "Checking with netstat..."'
200-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
200+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
201201
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
202202
error "Output validation failed"
203203
}
204204
sh 'echo "Installing iproute which contains ss command"'
205205
sh 'yum -y install iproute'
206206
sh 'echo "Checking with ss..."'
207-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
207+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
208208
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
209209
error "Output validation failed"
210210
}
@@ -229,14 +229,14 @@ pipeline {
229229
sh 'apachectl configtest'
230230
sh 'cat /etc/os-release'
231231
sh 'echo "Checking with netstat..."'
232-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
232+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
233233
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
234234
error "Output validation failed"
235235
}
236236
sh 'echo "Installing iproute which contains ss command"'
237237
sh 'yum -y install iproute'
238238
sh 'echo "Checking with ss..."'
239-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
239+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
240240
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
241241
error "Output validation failed"
242242
}
@@ -260,14 +260,14 @@ pipeline {
260260
sh 'apachectl configtest'
261261
sh 'cat /etc/os-release'
262262
sh 'echo "Checking with netstat..."'
263-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
263+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
264264
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
265265
error "Output validation failed"
266266
}
267267
sh 'echo "Installing iproute which contains ss command"'
268268
sh 'yum -y install iproute'
269269
sh 'echo "Checking with ss..."'
270-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
270+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
271271
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
272272
error "Output validation failed"
273273
}
@@ -291,14 +291,14 @@ pipeline {
291291
sh 'apachectl configtest'
292292
sh 'cat /etc/os-release'
293293
sh 'echo "Checking with netstat..."'
294-
def output_netstat = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
294+
def output_netstat = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
295295
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
296296
error "Output validation failed"
297297
}
298298
sh 'echo "Installing iproute which contains ss command"'
299299
sh 'yum -y install iproute'
300300
sh 'echo "Checking with ss..."'
301-
def output_ss = sh '/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
301+
def output_ss = sh(script: "/usr/sbin/httpd -k start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
302302
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
303303
error "Output validation failed"
304304
}
@@ -320,14 +320,14 @@ pipeline {
320320
sh 'php -v'
321321
sh 'cat /etc/os-release'
322322
sh 'echo "Checking with netstat..."'
323-
def output_netstat = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
323+
def output_netstat = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
324324
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
325325
error "Output validation failed"
326326
}
327327
sh 'echo "Installing iproute2 which contains ss command"'
328328
sh 'apt -y install iproute2'
329329
sh 'echo "Checking with ss..."'
330-
def output_ss = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
330+
def output_ss = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
331331
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
332332
error "Output validation failed"
333333
}
@@ -350,14 +350,14 @@ pipeline {
350350
sh 'php -v'
351351
sh 'cat /etc/os-release'
352352
sh 'echo "Checking with netstat..."'
353-
def output_netstat = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
353+
def output_netstat = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
354354
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
355355
error "Output validation failed"
356356
}
357357
sh 'echo "Installing iproute2 which contains ss command"'
358358
sh 'apt -y install iproute2'
359359
sh 'echo "Checking with ss..."'
360-
def output_ss = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
360+
def output_ss = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
361361
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
362362
error "Output validation failed"
363363
}
@@ -380,14 +380,14 @@ pipeline {
380380
sh 'php -v'
381381
sh 'cat /etc/os-release'
382382
sh 'echo "Checking with netstat..."'
383-
def output_netstat = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
383+
def output_netstat = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
384384
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
385385
error "Output validation failed"
386386
}
387387
sh 'echo "Installing iproute2 which contains ss command"'
388388
sh 'apt -y install iproute2'
389389
sh 'echo "Checking with ss..."'
390-
def output_ss = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
390+
def output_ss = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
391391
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
392392
error "Output validation failed"
393393
}
@@ -409,14 +409,14 @@ pipeline {
409409
sh 'php -v'
410410
sh 'cat /etc/os-release'
411411
sh 'echo "Checking with netstat..."'
412-
def output_netstat = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
412+
def output_netstat = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
413413
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
414414
error "Output validation failed"
415415
}
416416
sh 'echo "Installing iproute2 which contains ss command"'
417417
sh 'apt -y install iproute2'
418418
sh 'echo "Checking with ss..."'
419-
def output_ss = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
419+
def output_ss = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
420420
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
421421
error "Output validation failed"
422422
}
@@ -438,14 +438,14 @@ pipeline {
438438
sh 'php -v'
439439
sh 'cat /etc/os-release'
440440
sh 'echo "Checking with netstat..."'
441-
def output_netstat = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
441+
def output_netstat = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
442442
if (!output_netstat.contains("[ OK ] Using 'netstat' for socket statistics.")) {
443443
error "Output validation failed"
444444
}
445445
sh 'echo "Installing iproute2 which contains ss command"'
446446
sh 'apt -y install iproute2'
447447
sh 'echo "Checking with ss..."'
448-
def output_ss = sh 'service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n'
448+
def output_ss = sh(script: "service apache2 start && curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/staging/apache2buddy.pl | perl - -n", returnStdout: true).trim()
449449
if (!output_ss.contains("[ OK ] Using 'ss' for socket statistics.")) {
450450
error "Output validation failed"
451451
}

0 commit comments

Comments
 (0)