blob: 612223369cd0c167d9207f3a951d1f18a0ba5f61 [file] [log] [blame]
OlgaGusarenkof20d94d2018-07-30 18:48:25 +03001=====
2Usage
3=====
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +02004
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +04005Jenkins CI is an open source automation server written in Java. Jenkins
OlgaGusarenkof20d94d2018-07-30 18:48:25 +03006helps to automate the non-human part of software development process,
7with continuous integration and facilitating technical aspects of
8continuous delivery.
Dan Alvizu5d9336b2018-01-15 14:43:51 -07009
10More information can be found at `<https://jenkins.io/>`_
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020011
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030012Setup jenkins client, works with Salt 2016.3+, supports pipeline
13workflow projects only for now.
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020014
Dan Alvizu5d9336b2018-01-15 14:43:51 -070015Dependencies
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030016============
Dan Alvizu5d9336b2018-01-15 14:43:51 -070017
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030018To install on Ubuntu, you will need to add the jenkins debian repository
19to the target server. You can do this with the
20`salt-formula-linux formula <https://github.com/salt-formulas/salt-formula-linux>`_ ,
Dan Alvizu5d9336b2018-01-15 14:43:51 -070021with the following pillar data:
22
23.. code-block:: yaml
24
25 linux:
26 system:
27 enabled: true
28 repo:
29 jenkins:
30 enabled: true
31 source: "deb http://pkg.jenkins.io/debian-stable binary/"
32 key_url: "https://pkg.jenkins.io/debian/jenkins-ci.org.key"
33
34This state will need to be applied *before* the jenkins state.
35
36Using this formula
37==================
38
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030039To use this formula, you must install the formula to your Salt
40Master as documented in
41`saltstack formula docs <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#installation>`_
Dan Alvizu5d9336b2018-01-15 14:43:51 -070042
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030043This formula is driven by pillar data, and can be used to
44install either a Jenkins Master or Client. See pillar data
45below for examples.
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020046
Ales Komareke5a1ed62016-08-27 12:02:48 +020047Sample pillars
48==============
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020049
Ales Komarekffe8bb22017-02-09 11:10:16 +010050Master role
51-----------
Ales Komareke5a1ed62016-08-27 12:02:48 +020052
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030053Simple master with reverse proxy:
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020054
55.. code-block:: yaml
56
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020057 nginx:
58 server:
59 site:
60 jenkins:
61 enabled: true
62 type: nginx_proxy
63 name: jenkins
64 proxy:
65 host: 127.0.0.1
66 port: 8080
67 protocol: http
68 host:
69 name: jenkins.example.com
70 port: 80
71 jenkins:
72 master:
73 mode: EXCLUSIVE
Filip Pytloun52b9c2c2016-01-28 13:45:57 +010074 # Do not manage config.xml from Salt, use UI instead
75 no_config: true
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020076 slaves:
77 - name: slave01
78 label: pbuilder
79 executors: 2
80 - name: slave02
81 label: image_builder
82 mode: EXCLUSIVE
83 executors: 2
84 views:
85 - name: "Package builds"
86 regex: "debian-build-.*"
87 - name: "Contrail builds"
88 regex: "contrail-build-.*"
89 - name: "Aptly"
90 regex: "aptly-.*"
91 plugins:
92 - name: slack
93 - name: extended-choice-parameter
94 - name: rebuild
95 - name: test-stability
96
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030097Jenkins master with experimental plugin source support:
Ales Komarekaf967ee2016-08-31 19:38:50 +020098
99.. code-block:: yaml
100
101 jenkins:
102 master:
103 enabled: true
104 update_site_url: 'http://updates.jenkins-ci.org/experimental/update-center.json'
105
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300106SMTP server settings:
Ales Komarekaf967ee2016-08-31 19:38:50 +0200107
Ales Komarekffe8bb22017-02-09 11:10:16 +0100108.. code-block:: yaml
109
110 jenkins:
111 master:
112 email:
113 engine: "smtp"
114 host: "smtp.domain.com"
115 user: "user@domain.cz"
116 password: "smtp-password"
117 port: 25
118
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300119Script approvals from client:
Jakub Josefbf0b73e2017-03-22 14:32:45 +0100120
121.. code-block:: yaml
122
123 jenkins:
124 client:
125 approved_scripts:
126 - method groovy.json.JsonSlurperClassic parseText java.lang.String
127
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300128Script approvals:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100129
130.. code-block:: yaml
131
132 jenkins:
133 master:
134 approved_scripts:
135 - method groovy.json.JsonSlurperClassic parseText java.lang.String
136
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300137User enforcement:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100138
139.. code-block:: yaml
140
141 jenkins:
142 master:
143 user:
144 admin:
145 api_token: xxxxxxxxxx
146 password: admin_password
147 email: admin@domain.com
148 user01:
149 api_token: xxxxxxxxxx
150 password: user_password
151 email: user01@domain.com
152
Ales Komarekffe8bb22017-02-09 11:10:16 +0100153Agent (slave) role
154------------------
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200155
156.. code-block:: yaml
157
Ales Komarek4c0bab12016-01-22 12:10:50 +0100158 jenkins:
159 slave:
160 master:
161 host: jenkins.example.com
162 port: 80
Michael Kutý37a35952016-06-10 23:51:36 +0200163 protocol: http
Ales Komarek4c0bab12016-01-22 12:10:50 +0100164 user:
165 name: jenkins_slave
166 password: dexiech6AepohthaiHook2iesh7ol5ook4Ov3leid3yek6daid2ooNg3Ee2oKeYo
167 gpg:
168 keypair_id: A76882D3
169 public_key: |
170 -----BEGIN PGP PUBLIC KEY BLOCK-----
171 ...
172 private_key: |
173 -----BEGIN PGP PRIVATE KEY BLOCK-----
174 ...
Ales Komarekaf967ee2016-08-31 19:38:50 +0200175
Ales Komarekffe8bb22017-02-09 11:10:16 +0100176Client role
177-----------
Ales Komareke5a1ed62016-08-27 12:02:48 +0200178
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300179Simple client with workflow job definition:
Ales Komareke5a1ed62016-08-27 12:02:48 +0200180
181.. code-block:: yaml
182
183 jenkins:
184 client:
185 master:
186 host: jenkins.example.com
187 port: 80
188 protocol: http
189 job:
190 jobname:
191 type: workflow
192 param:
193 bool_param:
194 type: boolean
195 description: true/false
196 default: true
197 string_param:
198 type: string
199 description: 1 liner
200 default: default_string
201 text_param:
202 type: text
203 description: multi-liner
204 default: default_text
Filip Pytlounebd4d172016-09-01 14:23:20 +0200205 jobname_scm:
206 type: workflow-scm
207 concurrent: false
208 scm:
209 type: git
210 url: https://github.com/jenkinsci/docker.git
211 branch: master
212 script: Jenkinsfile
213 github:
214 url: https://github.com/jenkinsci/docker
215 name: "Jenkins Docker Image"
216 trigger:
Tomáš Kukrála9cf2c62017-03-04 11:25:20 +0100217 timer:
218 spec: "H H * * *"
Filip Pytlounebd4d172016-09-01 14:23:20 +0200219 github:
220 pollscm:
221 spec: "H/15 * * * *"
222 reverse:
223 projects:
224 - test1
225 - test2
226 state: SUCCESS
227 param:
228 bool_param:
229 type: boolean
230 description: true/false
231 default: true
232 string_param:
233 type: string
234 description: 1 liner
235 default: default_string
236 text_param:
237 type: text
238 description: multi-liner
239 default: default_text
Ales Komareke5a1ed62016-08-27 12:02:48 +0200240
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300241Inline Groovy scripts:
Ales Komareke5a1ed62016-08-27 12:02:48 +0200242
243.. code-block:: yaml
244
245 jenkins:
246 client:
247 job:
248 test_workflow_jenkins_simple:
249 type: workflow
250 display_name: Test jenkins simple workflow
Ales Komarek5b672fd2016-08-29 16:05:03 +0200251 script:
252 content: |
253 node {
254 stage 'Stage 1'
255 echo 'Hello World 1'
256 stage 'Stage 2'
257 echo 'Hello World 2'
258 }
Ales Komareke5a1ed62016-08-27 12:02:48 +0200259 test_workflow_jenkins_input:
260 type: workflow
261 display_name: Test jenkins workflow inputs
Ales Komarek5b672fd2016-08-29 16:05:03 +0200262 script:
263 content: |
264 node {
265 stage 'Enter string'
266 input message: 'Enter job parameters', ok: 'OK', parameters: [
267 string(defaultValue: 'default', description: 'Enter a string.', name: 'string'),
268 ]
269 stage 'Enter boolean'
270 input message: 'Enter job parameters', ok: 'OK', parameters: [
271 booleanParam(defaultValue: false, description: 'Select boolean.', name: 'Bool'),
272 ]
273 stage 'Enter text'
274 input message: 'Enter job parameters', ok: 'OK', parameters: [
275 text(defaultValue: '', description: 'Enter multiline', name: 'Multiline')
276 ]
277 }
Ales Komareke5a1ed62016-08-27 12:02:48 +0200278
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300279GIT controlled groovy scripts:
Ales Komarekdaf31f72016-08-29 11:00:13 +0200280
281.. code-block:: yaml
282
283 jenkins:
284 client:
285 source:
Ales Komarek5b672fd2016-08-29 16:05:03 +0200286 base:
287 engine: git
288 address: repo_url
289 branch: branch
290 domain:
291 engine: git
292 address: domain_url
293 branch: branch
Ales Komarekdaf31f72016-08-29 11:00:13 +0200294 job:
295 test_workflow_jenkins_simple:
296 type: workflow
297 display_name: Test jenkins simple workflow
Ales Komarek5b672fd2016-08-29 16:05:03 +0200298 param:
299 bool_param:
300 type: boolean
301 description: true/false
302 default: true
303 script:
304 repository: base
305 file: workflows/test_workflow_jenkins_simple.groovy
Ales Komarekdaf31f72016-08-29 11:00:13 +0200306 test_workflow_jenkins_input:
307 type: workflow
308 display_name: Test jenkins workflow inputs
Ales Komarek5b672fd2016-08-29 16:05:03 +0200309 script:
310 repository: domain
311 file: workflows/test_workflow_jenkins_input.groovy
312 test_workflow_jenkins_input_jenkinsfile:
313 type: workflow
314 display_name: Test jenkins workflow inputs (jenknisfile)
315 script:
316 repository: domain
317 file: workflows/test_workflow_jenkins_input/Jenkinsfile
Ales Komarekdaf31f72016-08-29 11:00:13 +0200318
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300319GIT controlled groovy script with shared libraries:
Ales Komarek5b672fd2016-08-29 16:05:03 +0200320
321.. code-block:: yaml
322
323 jenkins:
324 client:
325 source:
326 base:
327 engine: git
328 address: repo_url
329 branch: branch
330 domain:
331 engine: git
332 address: domain_url
333 branch: branch
334 job:
335 test_workflow_jenkins_simple:
336 type: workflow
337 display_name: Test jenkins simple workflow
338 param:
339 bool_param:
340 type: boolean
341 description: true/false
342 default: true
343 script:
344 repository: base
345 file: workflows/test_workflow_jenkins_simple.groovy
346 libs:
347 - repository: base
348 file: macros/cookiecutter.groovy
349 - repository: base
350 file: macros/git.groovy
Ales Komarekdaf31f72016-08-29 11:00:13 +0200351
Jakub Josef120714d2017-02-09 16:29:18 +0100352Setting job max builds to keep (amount of last builds stored on Jenkins master)
353
354.. code-block:: yaml
355
356 jenkins:
357 client:
358 job:
359 my-amazing-job:
360 type: workflow
361 discard:
362 build:
363 keep_num: 5
364 keep_days: 5
365 artifact:
366 keep_num: 6
367 keep_days: 6
368
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300369Using job templates in similar way as in jjb. For now just
3701 defined param is supported:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100371
372.. code-block:: yaml
373
374 jenkins:
375 client:
376 job_template:
377 test_workflow_template:
378 name: test-{{formula}}-workflow
379 template:
380 type: workflow
381 display_name: Test jenkins {{name}} workflow
382 param:
383 repo_param:
384 type: string
385 default: repo/{{formula}}
386 script:
387 repository: base
388 file: workflows/test_formula_workflow.groovy
389 param:
390 formula:
391 - aodh
392 - linux
393 - openssh
394
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300395Interpolating parameters for job templates:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100396
Filip Pytloun83129fc2017-02-23 10:07:32 +0100397.. code-block:: yaml
398
Ales Komarekffe8bb22017-02-09 11:10:16 +0100399 _param:
400 salt_formulas:
401 - aodh
402 - git
403 - nova
404 - xorg
405 jenkins:
406 client:
407 job_template:
408 test_workflow_template:
409 name: test-{{formula}}-workflow
410 template:
411 ...
412 param:
413 formula: ${_param:salt_formulas}
414
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300415Or simply define multiple jobs and it's parameters to
416replace from template:
Filip Pytloun83129fc2017-02-23 10:07:32 +0100417
418.. code-block:: yaml
419
420 jenkins:
421 client:
422 job_template:
423 test_workflow_template:
424 name: test-{{name}}-{{myparam}}
425 template:
426 ...
427 jobs:
428 - name: firstjob
429 myparam: dummy
430 - name: secondjob
431 myparam: dummyaswell
Ales Komarekffe8bb22017-02-09 11:10:16 +0100432
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300433Purging undefined jobs from Jenkins:
Jakub Josef2a7739b2017-01-24 18:33:44 +0100434
435.. code-block:: yaml
436
437 jenkins:
438 client:
439 purge_jobs: true
Ales Komarekffe8bb22017-02-09 11:10:16 +0100440 job:
441 my-amazing-job:
442 type: workflow
Jakub Josef2a7739b2017-01-24 18:33:44 +0100443
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300444Plugins management from client:
Jakub Josef10b4e102017-01-05 18:18:41 +0100445
446.. code-block:: yaml
447
Jakub Josef10b4e102017-01-05 18:18:41 +0100448 jenkins:
449 client:
450 plugin:
451 swarm:
452 restart: false
453 hipchat:
454 enabled: false
455 restart: true
456
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300457Adding plugin params to job:
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200458
459.. code-block:: yaml
460
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200461 jenkins:
462 client:
463 job:
464 my_plugin_parametrized_job:
465 plugin_properties:
466 throttleconcurrents:
467 enabled: True
468 max_concurrent_per_node: 3
Vasyl Saienko661acf42018-01-18 10:37:07 +0200469 max_concurrent_total: 1
470 throttle_option: category #one of project (default or category)
471 categories:
472 - my_throuttle_category
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200473 plugin:
474 swarm:
475 restart: false
476 hipchat:
477 enabled: false
478 restart: true
479
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300480LDAP configuration (depends on LDAP plugin):
Jakub Josef063a7532017-01-11 15:48:01 +0100481
482.. code-block:: yaml
483
484 jenkins:
485 client:
486 security:
487 ldap:
488 server: 1.2.3.4
489 root_dn: dc=foo,dc=com
490 user_search_base: cn=users,cn=accounts
491 manager_dn: ""
492 manager_password: password
493 user_search: ""
494 group_search_base: ""
495 inhibit_infer_root_dn: false
496
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300497Matrix configuration (depends on auth-matrix plugin):
Jakub Josef063a7532017-01-11 15:48:01 +0100498
499.. code-block:: yaml
500
501 jenkins:
502 client:
503 security:
504 matrix:
Jakub Josef0ee470e2017-01-17 11:46:58 +0100505 # set true for use ProjectMatrixAuthStrategy instead of GlobalMatrixAuthStrategy
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400506 project_based: false
Jakub Josef063a7532017-01-11 15:48:01 +0100507 permissions:
508 Jenkins:
509 # administrator access
510 ADMINISTER:
511 - admin
512 # read access (anonymous too)
513 READ:
514 - anonymous
515 - user1
516 - user2
517 # agents permissions
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400518 MasterComputer:
519 BUILD:
Jakub Josef063a7532017-01-11 15:48:01 +0100520 - user3
521 # jobs permissions
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400522 hudson:
Jakub Josef063a7532017-01-11 15:48:01 +0100523 model:
524 Item:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400525 BUILD:
Jakub Josef063a7532017-01-11 15:48:01 +0100526 - user4
527
528`Common matrix strategies <https://github.com/arbabnazar/configuration/blob/c08a5eaf4e04a68d2481375502a926517097b253/playbooks/roles/tools_jenkins/templates/projectBasedMatrixSecurity.groovy.j2>`_
529
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300530Views enforcing from client:
Jakub Josef7bb17ab2017-01-12 14:52:53 +0100531
532.. code-block:: yaml
533
534 jenkins:
535 client:
536 view:
537 my-list-view:
538 enabled: true
539 type: ListView
Jakub Josef7d9fce32017-03-24 16:46:56 +0100540 include_regex: ".*"
Jakub Josef7bb17ab2017-01-12 14:52:53 +0100541 my-view:
542 # set false to disable
543 enabled: true
544 type: MyView
545
546View specific params:
547
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300548- ``include_regex`` for ``ListView`` and ``CategorizedJobsView``
549- categories for ``CategorizedJobsView``
Jakub Josef7d9fce32017-03-24 16:46:56 +0100550
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300551Categorized views:
Jakub Josef7d9fce32017-03-24 16:46:56 +0100552
553.. code-block:: yaml
554
555 jenkins:
556 client:
557 view:
558 my-categorized-view:
559 enabled: true
560 type: CategorizedJobsView
561 include_regex: ".*"
562 categories:
563 - group_regex: "aptly-.*-nightly-testing"
564 naming_rule: "Nightly -> Testing"
565 - group_regex: "aptly-.*-nightly-production"
566 naming_rule: "Nightly -> Production"
Jakub Josef7bb17ab2017-01-12 14:52:53 +0100567
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300568Credentials enforcing from client:
Jakub Josef123be7a2016-12-12 16:02:36 +0100569
570.. code-block:: yaml
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200571
Jakub Josef123be7a2016-12-12 16:02:36 +0100572 jenkins:
573 client:
574 credential:
575 cred_first:
576 username: admin
577 password: password
578 cred_second:
579 username: salt
580 password: password
581 cred_with_key:
582 username: admin
583 key: SOMESSHKEY
Sergey Otpuschennikov1dd77992018-06-27 11:11:07 +0400584 cred_with_text_secret:
585 secret: SOMETEXTSECRET
Jakub Josef123be7a2016-12-12 16:02:36 +0100586
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300587Users enforcing from client:
Jakub Josef123be7a2016-12-12 16:02:36 +0100588
589.. code-block:: yaml
590
591 jenkins:
592 client:
593 user:
594 admin:
595 password: admin_password
596 admin: true
597 user01:
598 password: user_password
599
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300600Node enforcing from client using JNLP launcher:
Jakub Josef123be7a2016-12-12 16:02:36 +0100601
602.. code-block:: yaml
603
604 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100605 client:
606 node:
607 node01:
608 remote_home: /remote/home/path
609 desc: node-description
610 num_executors: 1
611 node_mode: Normal
612 ret_strategy: Always
613 labels:
614 - example
615 - label
616 launcher:
617 type: jnlp
Jakub Josef123be7a2016-12-12 16:02:36 +0100618
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300619Node enforcing from client using SSH launcher:
Jakub Josef123be7a2016-12-12 16:02:36 +0100620
621.. code-block:: yaml
622
623 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100624 client:
625 node:
626 node01:
627 remote_home: /remote/home/path
628 desc: node-description
629 num_executors: 1
630 node_mode: Normal
631 ret_strategy: Always
632 labels:
633 - example
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200634 - label
Ales Komarekffe8bb22017-02-09 11:10:16 +0100635 launcher:
636 type: ssh
637 host: test-launcher
638 port: 22
639 username: launcher-user
640 password: launcher-pass
Jakub Josef123be7a2016-12-12 16:02:36 +0100641
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300642Configure Jenkins master:
Jakub Josef1bb7f442017-05-26 17:02:56 +0200643
644.. code-block:: yaml
645
646 jenkins:
647 client:
648 node:
649 master:
650 num_executors: 1
651 node_mode: Normal # or Exclusive
652 labels:
653 - example
654 - label
655
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300656Setting node labels:
Jakub Josef123be7a2016-12-12 16:02:36 +0100657
658.. code-block:: yaml
659
660 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100661 client:
662 label:
663 node-name:
664 lbl_text: label-offline
665 append: false # set true for label append instead of replace
Jakub Josefd8e04292016-11-28 18:02:27 +0100666
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300667SMTP server settings from client:
Jakub Josef60cc9d22017-01-18 12:02:14 +0100668
669.. code-block:: yaml
670
671 jenkins:
672 client:
673 smtp:
674 host: "smtp.domain.com"
675 username: "user@domain.cz"
676 password: "smtp-password"
677 port: 25
678 ssl: false
679 reply_to: reply_to@address.com
680
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300681Jenkins admin user email enforcement from client:
Jakub Josefdfb288c2017-04-27 17:29:00 +0200682
683.. code-block:: yaml
684
685 jenkins:
686 client:
687 smtp:
688 admin_email: "My Jenkins <jenkins@myserver.com>"
689
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300690Slack plugin configuration:
Jakub Josefa6d4c832017-01-19 14:06:12 +0100691
692.. code-block:: yaml
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400693
Jakub Josefa6d4c832017-01-19 14:06:12 +0100694 jenkins:
695 client:
696 slack:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100697 team_domain: example.com
698 token: slack-token
699 room: slack-room
Jakub Josef6e0cda92017-02-14 18:01:58 +0100700 token_credential_id: cred_id
Ales Komarekffe8bb22017-02-09 11:10:16 +0100701 send_as: Some slack user
Jakub Josefa6d4c832017-01-19 14:06:12 +0100702
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300703Pipeline global libraries setup:
Jakub Josef6e0cda92017-02-14 18:01:58 +0100704
705.. code-block:: yaml
706
707 jenkins:
708 client:
709 lib:
710 my-pipeline-library:
711 enabled: true
712 url: https://path-to-my-library
713 credential_id: github
714 branch: master # optional, default master
715 implicit: true # optional default true
Jakub Josefd8e04292016-11-28 18:02:27 +0100716
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300717Artifactory server enforcing:
Jakub Josef01940252017-05-10 14:01:22 +0200718
719.. code-block:: yaml
720
721 jenkins:
722 client:
723 artifactory:
724 my-artifactory-server:
725 enabled: true
726 url: https://path-to-my-library
727 credential_id: github
728
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300729Jenkins Global env properties enforcing:
Jakub Josef184ee1c2017-11-29 16:03:09 +0100730
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400731.. code-block:: yaml
Jakub Josef184ee1c2017-11-29 16:03:09 +0100732
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400733 jenkins:
734 client:
735 globalenvprop:
736 OFFLINE_DEPLOYMENT:
737 enabled: true
738 name: "OFFLINE_DEPLOYMENT" # optional, default using dict key
739 value: "true"
Jakub Josef184ee1c2017-11-29 16:03:09 +0100740
Dmitry Burmistrova3f2c132018-04-10 16:24:25 +0400741Throttle categories management from client (requires
742`Throttle Concurrent Builds <https://plugins.jenkins.io/throttle-concurrents>`_
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300743plugin):
Dmitry Burmistrova3f2c132018-04-10 16:24:25 +0400744
745.. code-block:: yaml
746
747 jenkins:
748 client:
749 throttle_category:
750 'My First Category':
751 max_total: 2
752 max_per_node: 1
753 'My Second Category':
754 max_total: 5
755 max_per_node: 2
756 max_per_label:
757 'node_label_1': 1
758 'node_label_2': 2
759 'My Category To Remove:
760 enabled: false
761
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400762Jira sites management from client (requires
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300763`JIRA <https://plugins.jenkins.io/jira>`_ plugin):
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400764
765.. code-block:: yaml
766
767 # Remove all sites
768 jenkins:
769 client:
770 jira:
771 enabled: False
772
773.. code-block:: yaml
774
775 jenkins:
776 client:
777 jira:
778 sites:
779 'http://my.jira.site/':
780 link_url: 'http://alternative.link/'
781 http_auth: false
782 use_wiki_notation: false
783 record_scm: false
784 disable_changelog: false
785 issue_pattern: ''
786 any_build_result: false
787 user: 'username'
788 password: 'passwd'
789 conn_timeout: 10
790 visible_for_group: ''
791 visible_for_project: ''
792 timestamps: false
793 timestamp_format: ''
Sergey Otpuschennikov74ea2682018-05-21 16:35:36 +0400794
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300795Gerrit trigger plugin configuration:
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400796
797.. code-block:: yaml
798
799 jenkins:
800 client:
801 gerrit:
802 server1:
803 host: "gerrit.domain.local"
804 port: 29418
805 username: "jenkins"
806 email: "jenkins@domain.local"
807 auth_key_file: "/var/jenkins_home/.ssh/id_rsa"
808 frontendURL: "https://gerrit.domain.local"
809 authkey: |
810 SOMESSHKEY
811 server2:
812 host: "gerrit2.domain.local"
813 port: 29418
814 username: "jenkins"
815 email: "jenkins@domain.local"
816 auth_key_file: "/var/jenkins_home/.ssh/id_rsa"
817 frontendURL: "https://gerrit2.domain.local"
818 authkey: |
819 SOMESSHKEY
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400820
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300821CSRF Protection configuration:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400822
823.. code-block:: yaml
824
825 jenkins:
826 client:
827 security:
828 csrf:
829 enabled: true
830 proxy_compat: false
831
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300832Agent to Master Access Control:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400833
834.. code-block:: yaml
835
836 jenkins:
837 client:
838 security:
839 agent2master:
840 enabled: true
841 whitelisted: ''
842 file_path_rules: ''
843
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300844Content Security Policy configuration:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400845
846.. code-block:: yaml
847
848 jenkins:
849 client:
850 security:
851 csp: "sandbox; default-src 'none'; img-src 'self'; style-src 'self';"
852
Ales Komarek4c0bab12016-01-22 12:10:50 +0100853Usage
854=====
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200855
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300856#. Generate password hash:
Ales Komarek4c0bab12016-01-22 12:10:50 +0100857
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300858 .. code-block:: bash
Ales Komarek4c0bab12016-01-22 12:10:50 +0100859
860 echo -n "salt{plainpassword}" | openssl dgst -sha256
861
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300862#. Place in the configuration ``salt:hashpassword``.
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200863
Ales Komarekffe8bb22017-02-09 11:10:16 +0100864
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300865Read more
866=========
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200867
868* https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100869
870Documentation and Bugs
871======================
872
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300873* http://salt-formulas.readthedocs.io/
874 Learn how to install and update salt-formulas
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100875
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300876* https://github.com/salt-formulas/salt-formula-jenkins/issues
877 In the unfortunate event that bugs are discovered, report the issue to the
878 appropriate issue tracker. Use the Github issue tracker for a specific salt
879 formula
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100880
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300881* https://launchpad.net/salt-formulas
882 For feature requests, bug reports, or blueprints affecting the entire
883 ecosystem, use the Launchpad salt-formulas project
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100884
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300885* https://launchpad.net/~salt-formulas-users
886 Join the salt-formulas-users team and subscribe to mailing list if required
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100887
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300888* https://github.com/salt-formulas/salt-formula-jenkins
889 Develop the salt-formulas projects in the master branch and then submit pull
890 requests against a specific formula
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100891
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300892* #salt-formulas @ irc.freenode.net
893 Use this IRC channel in case of any questions or feedback which is always
894 welcome
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100895