-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
504 lines (432 loc) · 16.2 KB
/
index.html
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PHPipelines in the Wild</title>
<meta name="description" content="Jenkins 2 Pipelines with PHP">
<meta name="author" content="Luis Ferro">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<link rel="apple-touch-icon" sizes="57x57" href="/images/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/images/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/images/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/images/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/images/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/images/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/images/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/images/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/images/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/images/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16.png">
<link rel="manifest" href="/images/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/images/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section data-background="/images/xray.jpg">
<br />
<h1 style="color:#777bb3">PHP SW</h1>
<h3 style="color:#777bb3">08 Nov 2017</h3>
<br />
<br />
<p>https://www.meetup.com/php-sw</p>
<br />
<p><a href="http://www.basekit.com/"><small>Hosted in: BaseKit, Bristol</small></a>
</p>
</section>
<section>
<h1>PhPipelines In The Wild</h1>
<br />
<h2>Jenkins 2 + PHP</h2>
<br />
<p>The PHP development toolchain exposed</p>
</section>
<section>
<h2>Who am I</h2>
<ul>
<li>Luis Ferro</li>
<li class="fragment">Developer since... ZX Spectrum</li>
<li class="fragment">PHP developer since... 1998</li>
<li class="fragment">Archer (yes, i also shoot arrows :)</li>
<li class="fragment"><a href="https://twitter.com/lferro9000">@lferro9000</a></li>
<li class="fragment"><a href="https://github.com/lferro9000">github.com/lferro9000</a></li>
</ul>
<p class="fragment">
<small>This talk and all materials are on github.</small>
</p>
</section>
<section>
<img src="/images/jenkins.png">
<h2>Jenkins</h2>
<p>is like a good butler, runs things for you</p>
<p><a href="https://jenkins.io">jenkins.io</a></p>
</section>
<section>
<h2>Jenkins History</h2>
<ul>
<li>We had a buttler called Hudson</li>
<li class="fragment">He worked through an agency called SUN</li>
<li class="fragment">Got "fired" in 2011, when SUN was brought by Oracle</li>
<li class="fragment">Jenkins was "hired" from an "Open Agency"</li>
<li class="fragment">Then we sent Jenkins to a training of "Pipelines"</li>
</ul>
</section>
<section>
<h2>Why Jenkins</h2>
<ul>
<li>It automates everything</li>
<li class="fragment">Runs tasks when there is a code change</li>
<li class="fragment">Builds our software</li>
<li class="fragment">Tests our software</li>
<li class="fragment">Can even deploy our software!</li>
</ul>
</section>
<section>
<h2>Jenkins 1 and PHP</h2>
<ul>
<li class="fragment">There is a good guide for Jenkins 1</li>
<li class="fragment">http://jenkins-php.org/</li>
</ul>
</section>
<section>
<h2>Jenkins 2 and PHP</h2>
<ul>
<li class="fragment">There wasn't much apart from this gist</li>
<li class="fragment">https://goo.gl/uo84tM</li>
<li class="fragment">Based on it, i've written this small guide:</li>
<li class="fragment">https://goo.gl/AzNSwe</li>
<li class="fragment">And doing this talk :)</li>
</ul>
</section>
<section style="text-align: left">
<h2 style="text-align: center">Instalation</h2>
<li class="fragment">
Available in <a href="https://jenkins.io/download/">https://jenkins.io/download/</a>
</li>
<li class="fragment">
Installers for: Arch Linux, Docker, FreeBSD, Gentoo, Mac OS X, OpenBSD, openSUSE, Red Hat/Fedora/CentOS, Ubuntu/Debian, Windows
</li>
<li class="fragment">
Generic Java package (.war, on any JVM environment)
</li>
</section>
<section>
<h2>Jenkins Pipelines</h2>
<p>
This is the project we are going to add to our pipelines
</p>
<img src="/images/jenkins-project.png">
</section>
<section>
<h2>New Pipeline</h2>
<p>
Go to dashboard, press +New to add a new item<br>
Then "pipeline", "Ok", and "save"
</p>
<img src="/images/new-pipeline.png" height="400">
</section>
<section>
<h2>Save and Build</h2>
<p>
On the item configuration, save it. Then press "build"
</p>
<img src="/images/empty-build.png">
</section>
<section>
<h2>Pipelines and stages</h2>
<p>
This is the pipeline box where we define everything
</p>
<p>
It's implemented with the Apache Groovie language
</p>
<p style="text-align: left">
Groovie: <a href="http://groovy-lang.org/">http://groovy-lang.org/</a><br>
Pipelines: <a href="https://jenkins.io/doc/pipeline/steps/">https://jenkins.io/doc/pipeline/steps/</a><br>
Syntax: <a href="https://jenkins.io/doc/book/pipeline/jenkinsfile/">https://jenkins.io/doc/book/pipeline/jenkinsfile/</a><br>
</p>
</section>
<section>
<h2>Check simple pipeline</h2>
<p>
php -v
</p>
<img src="/images/pipeline-console.png">
</section>
<section>
<h2>Composer pipeline</h2>
<p>
composer
</p>
<img src="/images/composer-broken.png">
</section>
<section>
<h2>Pipeline result (1/2)</h2>
<p>
composer is broken
</p>
<img src="/images/composer-broken1.png">
</section>
<section>
<h2>Pipeline result (2/2)</h2>
<p>
composer is broken
</p>
<img src="/images/composer-broken2.png">
</section>
<section>
<h2>Fix composer (1/5)</h2>
<p>
Go to "Manage Jenkins", then "Manage Nodes"
</p>
<img src="/images/nodes.png">
</section>
<section>
<h2>Fix composer (2/5)</h2>
<p>
Select the master node
</p>
<img src="/images/master-node.png">
</section>
<section>
<h2>Fix composer (3/5)</h2>
<p>
On a terminal, issue "export" to check what is on the path
</p>
<img src="/images/terminal-path.png">
</section>
<section>
<h2>Fix composer (4/5)</h2>
<p>
Edit the node and add an environment variable for path
</p>
<img src="/images/path-on-jenkins.png">
</section>
<section>
<h2>Fix composer (5/5)</h2>
<p>
Rerun the build
</p>
<img src="/images/rerun-build.png">
</section>
<section>
<h2>phpunit and behat</h2>
<p>
Running PHPUnit and Behat
</p>
<img src="/images/phpunit-behat.png">
</section>
<section>
<h2>Full PHP setup</h2>
<p>
Running everything plus the kitchen sink
</p>
<img src="/images/php-full.png">
</section>
<section>
<h2>SCM</h2>
<p>
Fetching the source code
</p>
<img src="/images/scm.png">
</section>
<section>
<h2>Composer</h2>
<p>
Composer Install
</p>
<img src="/images/composer.png">
</section>
<section>
<h2>Lint</h2>
<p>
Sanity Check all code
</p>
<img src="/images/lint.png">
</section>
<section>
<h2>PHPUnit</h2>
<p>
Run your tests
</p>
<img src="/images/phpunit.png">
</section>
<section>
<h2>Coverage</h2>
<p>
Publish the code coverage from phpunit stats
</p>
<img src="/images/coverage-code.png">
</section>
<section>
<h2>The Coverage Report</h2>
<img src="/images/coverage-report.png">
</section>
<section>
<h2>CheckStyle</h2>
<p>
Ensure your code is in the correct coding standard styles
</p>
<img src="/images/checkstyle-code.png">
</section>
<section>
<h2>CheckStyle Report</h2>
<img src="/images/checkstyle-report.png">
</section>
<section>
<h2>Mess Detection</h2>
<p>
No more spaghetti allowed
</p>
<img src="/images/mess-detection-code.png">
</section>
<section>
<h2>Mess Detection Report</h2>
<img src="/images/pmd.png">
</section>
<section>
<h2>Code Duplication</h2>
<p>
Code duplication detection
</p>
<img src="/images/cpd-report-code.png">
</section>
<section>
<h2>Duplicate Report</h2>
<p>
Code duplication detection
</p>
<img src="/images/duplicate-report.png">
</section>
<section>
<h2>Lines of Code</h2>
<p>
Fetching the source code
</p>
<img src="/images/loc-code.png">
</section>
<section>
<h2>PDepends</h2>
<p>
Fetching the source code
</p>
<img src="/images/pdepend-code.png">
</section>
<section>
<h2>PHP Metrics</h2>
<p>
Fetching the source code
</p>
<img src="/images/phpmetrics.png">
</section>
<section>
<h2>PHP Metrics Report</h2>
<img src="/images/phpmetrics-report.png">
</section>
<section>
<h2>Docs</h2>
<p>
Generate base docs from the metrics and docblocks
</p>
<img src="/images/docs-code.png">
</section>
<section>
<h2>Docs Publish</h2>
<p>
Link the docs into the Jenkins Job
</p>
<img src="/images/docs-publish-code.png">
</section>
<section>
<h2>Docs Report</h2>
<img src="/images/docs.png">
</section>
<section>
<h2>Notify</h2>
<p>
Notify if success or failure by email, etc
</p>
<img src="/images/notify-code.png">
</section>
<section>
<h2>Jenkinsfile examples</h2>
<p>
<a href="https://github.com/dalalv/jenkinsfiles">https://github.com/dalalv/jenkinsfiles</a><br>
</p>
<p>
Use github search power: <a href="https://github.com/search?utf8=%E2%9C%93&q=JenkinsFile&type=">https://github.com/search?utf8=%E2%9C%93&q=JenkinsFile&type=</a>
</p>
</section>
<section>
<h2>Some references:</h2>
<p>
https://www.sitepoint.com/re-introducing-jenkins-automated-testing-with-pipelines/
</p>
<p>
https://medium.com/garbage-collection/jenkins-pipelines-what-i-wish-i-knew-starting-out-6e3d4eb2ff5b
</p>
<p>
https://medium.com/@lferro9000/elephpant-in-the-pipeline-ci-8164579d01cc
</p>
</section>
<section>
<h2>Have fun with Jenkins Pipelines</h2>
<img src="images/evil-jenkins.png">
</section>
<section style="text-align: left;">
<h1>THE END</h1>
<p>
- <a href="https://github.com/hakimel/reveal.js">Source code & documentation</a><br>
- <a href="https://www.flickr.com/photos/asjaboros/3021251711/">X Ray - by Asja Boroš, CC 2.0</a><br>
- <a href="https://creativecommons.org/licenses/by/2.0/">CC 2.0</a><br>
- <a href="https://jenkins.io/">Jenkins Artwork, CC BY-SA 3.0</a>
- <a href="https://creativecommons.org/licenses/by-sa/3.0/">CC BY-SA 3.0</a>
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>