blob: 6b43e7e000b504557fd29acfb06b735f5d5734d8 [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
Alexander Evseev2c494d72018-08-01 11:52:18 +020074 java_args: -Xms256m -Xmx1g
Alexander Evseev1ed23bf2018-08-02 12:12:19 +020075 # Do not manage any xml config files via Salt, use UI instead
76 # Including config.xml and any plugin xml's.
Filip Pytloun52b9c2c2016-01-28 13:45:57 +010077 no_config: true
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +020078 slaves:
79 - name: slave01
80 label: pbuilder
81 executors: 2
82 - name: slave02
83 label: image_builder
84 mode: EXCLUSIVE
85 executors: 2
86 views:
87 - name: "Package builds"
88 regex: "debian-build-.*"
89 - name: "Contrail builds"
90 regex: "contrail-build-.*"
91 - name: "Aptly"
92 regex: "aptly-.*"
93 plugins:
94 - name: slack
95 - name: extended-choice-parameter
96 - name: rebuild
97 - name: test-stability
98
OlgaGusarenkof20d94d2018-07-30 18:48:25 +030099Jenkins master with experimental plugin source support:
Ales Komarekaf967ee2016-08-31 19:38:50 +0200100
101.. code-block:: yaml
102
103 jenkins:
104 master:
105 enabled: true
106 update_site_url: 'http://updates.jenkins-ci.org/experimental/update-center.json'
107
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300108SMTP server settings:
Ales Komarekaf967ee2016-08-31 19:38:50 +0200109
Ales Komarekffe8bb22017-02-09 11:10:16 +0100110.. code-block:: yaml
111
112 jenkins:
113 master:
114 email:
115 engine: "smtp"
116 host: "smtp.domain.com"
117 user: "user@domain.cz"
118 password: "smtp-password"
119 port: 25
120
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300121Script approvals from client:
Jakub Josefbf0b73e2017-03-22 14:32:45 +0100122
123.. code-block:: yaml
124
125 jenkins:
126 client:
127 approved_scripts:
128 - method groovy.json.JsonSlurperClassic parseText java.lang.String
129
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300130Script approvals:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100131
132.. code-block:: yaml
133
134 jenkins:
135 master:
136 approved_scripts:
137 - method groovy.json.JsonSlurperClassic parseText java.lang.String
138
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300139User enforcement:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100140
141.. code-block:: yaml
142
143 jenkins:
144 master:
145 user:
146 admin:
147 api_token: xxxxxxxxxx
148 password: admin_password
149 email: admin@domain.com
150 user01:
151 api_token: xxxxxxxxxx
152 password: user_password
153 email: user01@domain.com
154
Ales Komarekffe8bb22017-02-09 11:10:16 +0100155Agent (slave) role
156------------------
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200157
158.. code-block:: yaml
159
Ales Komarek4c0bab12016-01-22 12:10:50 +0100160 jenkins:
161 slave:
162 master:
163 host: jenkins.example.com
164 port: 80
Michael Kutý37a35952016-06-10 23:51:36 +0200165 protocol: http
Ales Komarek4c0bab12016-01-22 12:10:50 +0100166 user:
167 name: jenkins_slave
168 password: dexiech6AepohthaiHook2iesh7ol5ook4Ov3leid3yek6daid2ooNg3Ee2oKeYo
169 gpg:
170 keypair_id: A76882D3
171 public_key: |
172 -----BEGIN PGP PUBLIC KEY BLOCK-----
173 ...
174 private_key: |
175 -----BEGIN PGP PRIVATE KEY BLOCK-----
176 ...
Ales Komarekaf967ee2016-08-31 19:38:50 +0200177
Ales Komarekffe8bb22017-02-09 11:10:16 +0100178Client role
179-----------
Ales Komareke5a1ed62016-08-27 12:02:48 +0200180
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300181Simple client with workflow job definition:
Ales Komareke5a1ed62016-08-27 12:02:48 +0200182
183.. code-block:: yaml
184
185 jenkins:
186 client:
187 master:
188 host: jenkins.example.com
189 port: 80
190 protocol: http
191 job:
192 jobname:
193 type: workflow
194 param:
195 bool_param:
196 type: boolean
197 description: true/false
198 default: true
199 string_param:
200 type: string
201 description: 1 liner
202 default: default_string
203 text_param:
204 type: text
205 description: multi-liner
206 default: default_text
Filip Pytlounebd4d172016-09-01 14:23:20 +0200207 jobname_scm:
208 type: workflow-scm
209 concurrent: false
210 scm:
211 type: git
212 url: https://github.com/jenkinsci/docker.git
213 branch: master
214 script: Jenkinsfile
215 github:
216 url: https://github.com/jenkinsci/docker
217 name: "Jenkins Docker Image"
218 trigger:
Tomáš Kukrála9cf2c62017-03-04 11:25:20 +0100219 timer:
220 spec: "H H * * *"
Filip Pytlounebd4d172016-09-01 14:23:20 +0200221 github:
222 pollscm:
223 spec: "H/15 * * * *"
224 reverse:
225 projects:
226 - test1
227 - test2
228 state: SUCCESS
229 param:
230 bool_param:
231 type: boolean
232 description: true/false
233 default: true
234 string_param:
235 type: string
236 description: 1 liner
237 default: default_string
238 text_param:
239 type: text
240 description: multi-liner
241 default: default_text
Ales Komareke5a1ed62016-08-27 12:02:48 +0200242
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300243Inline Groovy scripts:
Ales Komareke5a1ed62016-08-27 12:02:48 +0200244
245.. code-block:: yaml
246
247 jenkins:
248 client:
249 job:
250 test_workflow_jenkins_simple:
251 type: workflow
252 display_name: Test jenkins simple workflow
Ales Komarek5b672fd2016-08-29 16:05:03 +0200253 script:
254 content: |
255 node {
256 stage 'Stage 1'
257 echo 'Hello World 1'
258 stage 'Stage 2'
259 echo 'Hello World 2'
260 }
Ales Komareke5a1ed62016-08-27 12:02:48 +0200261 test_workflow_jenkins_input:
262 type: workflow
263 display_name: Test jenkins workflow inputs
Ales Komarek5b672fd2016-08-29 16:05:03 +0200264 script:
265 content: |
266 node {
267 stage 'Enter string'
268 input message: 'Enter job parameters', ok: 'OK', parameters: [
269 string(defaultValue: 'default', description: 'Enter a string.', name: 'string'),
270 ]
271 stage 'Enter boolean'
272 input message: 'Enter job parameters', ok: 'OK', parameters: [
273 booleanParam(defaultValue: false, description: 'Select boolean.', name: 'Bool'),
274 ]
275 stage 'Enter text'
276 input message: 'Enter job parameters', ok: 'OK', parameters: [
277 text(defaultValue: '', description: 'Enter multiline', name: 'Multiline')
278 ]
279 }
Ales Komareke5a1ed62016-08-27 12:02:48 +0200280
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300281GIT controlled groovy scripts:
Ales Komarekdaf31f72016-08-29 11:00:13 +0200282
283.. code-block:: yaml
284
285 jenkins:
286 client:
287 source:
Ales Komarek5b672fd2016-08-29 16:05:03 +0200288 base:
289 engine: git
290 address: repo_url
291 branch: branch
292 domain:
293 engine: git
294 address: domain_url
295 branch: branch
Ales Komarekdaf31f72016-08-29 11:00:13 +0200296 job:
297 test_workflow_jenkins_simple:
298 type: workflow
299 display_name: Test jenkins simple workflow
Ales Komarek5b672fd2016-08-29 16:05:03 +0200300 param:
301 bool_param:
302 type: boolean
303 description: true/false
304 default: true
305 script:
306 repository: base
307 file: workflows/test_workflow_jenkins_simple.groovy
Ales Komarekdaf31f72016-08-29 11:00:13 +0200308 test_workflow_jenkins_input:
309 type: workflow
310 display_name: Test jenkins workflow inputs
Ales Komarek5b672fd2016-08-29 16:05:03 +0200311 script:
312 repository: domain
313 file: workflows/test_workflow_jenkins_input.groovy
314 test_workflow_jenkins_input_jenkinsfile:
315 type: workflow
316 display_name: Test jenkins workflow inputs (jenknisfile)
317 script:
318 repository: domain
319 file: workflows/test_workflow_jenkins_input/Jenkinsfile
Ales Komarekdaf31f72016-08-29 11:00:13 +0200320
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300321GIT controlled groovy script with shared libraries:
Ales Komarek5b672fd2016-08-29 16:05:03 +0200322
323.. code-block:: yaml
324
325 jenkins:
326 client:
327 source:
328 base:
329 engine: git
330 address: repo_url
331 branch: branch
332 domain:
333 engine: git
334 address: domain_url
335 branch: branch
336 job:
337 test_workflow_jenkins_simple:
338 type: workflow
339 display_name: Test jenkins simple workflow
340 param:
341 bool_param:
342 type: boolean
343 description: true/false
344 default: true
345 script:
346 repository: base
347 file: workflows/test_workflow_jenkins_simple.groovy
348 libs:
349 - repository: base
350 file: macros/cookiecutter.groovy
351 - repository: base
352 file: macros/git.groovy
Ales Komarekdaf31f72016-08-29 11:00:13 +0200353
Jakub Josef120714d2017-02-09 16:29:18 +0100354Setting job max builds to keep (amount of last builds stored on Jenkins master)
355
356.. code-block:: yaml
357
358 jenkins:
359 client:
360 job:
361 my-amazing-job:
362 type: workflow
363 discard:
364 build:
365 keep_num: 5
366 keep_days: 5
367 artifact:
368 keep_num: 6
369 keep_days: 6
370
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300371Using job templates in similar way as in jjb. For now just
3721 defined param is supported:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100373
374.. code-block:: yaml
375
376 jenkins:
377 client:
378 job_template:
379 test_workflow_template:
380 name: test-{{formula}}-workflow
381 template:
382 type: workflow
383 display_name: Test jenkins {{name}} workflow
384 param:
385 repo_param:
386 type: string
387 default: repo/{{formula}}
388 script:
389 repository: base
390 file: workflows/test_formula_workflow.groovy
391 param:
392 formula:
393 - aodh
394 - linux
395 - openssh
396
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300397Interpolating parameters for job templates:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100398
Filip Pytloun83129fc2017-02-23 10:07:32 +0100399.. code-block:: yaml
400
Ales Komarekffe8bb22017-02-09 11:10:16 +0100401 _param:
402 salt_formulas:
403 - aodh
404 - git
405 - nova
406 - xorg
407 jenkins:
408 client:
409 job_template:
410 test_workflow_template:
411 name: test-{{formula}}-workflow
412 template:
413 ...
414 param:
415 formula: ${_param:salt_formulas}
416
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300417Or simply define multiple jobs and it's parameters to
418replace from template:
Filip Pytloun83129fc2017-02-23 10:07:32 +0100419
420.. code-block:: yaml
421
422 jenkins:
423 client:
424 job_template:
425 test_workflow_template:
426 name: test-{{name}}-{{myparam}}
427 template:
428 ...
429 jobs:
430 - name: firstjob
431 myparam: dummy
432 - name: secondjob
433 myparam: dummyaswell
Ales Komarekffe8bb22017-02-09 11:10:16 +0100434
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300435Purging undefined jobs from Jenkins:
Jakub Josef2a7739b2017-01-24 18:33:44 +0100436
437.. code-block:: yaml
438
439 jenkins:
440 client:
441 purge_jobs: true
Ales Komarekffe8bb22017-02-09 11:10:16 +0100442 job:
443 my-amazing-job:
444 type: workflow
Jakub Josef2a7739b2017-01-24 18:33:44 +0100445
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300446Plugins management from client:
Jakub Josef10b4e102017-01-05 18:18:41 +0100447
448.. code-block:: yaml
449
Jakub Josef10b4e102017-01-05 18:18:41 +0100450 jenkins:
451 client:
Alexander Evseevcd836a12018-07-27 13:02:45 +0200452 plugin_remove_unwanted: false
453 plugin_force_remove: false
Jakub Josef10b4e102017-01-05 18:18:41 +0100454 plugin:
Alexander Evseevcd836a12018-07-27 13:02:45 +0200455 plugin1: 1.2.3
456 plugin2:
457 plugin3: {}
458 plugin4:
459 version: 3.2.1
Jakub Josef10b4e102017-01-05 18:18:41 +0100460 enabled: false
Alexander Evseevcd836a12018-07-27 13:02:45 +0200461 plugin5: absent
Jakub Josef10b4e102017-01-05 18:18:41 +0100462
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300463Adding plugin params to job:
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200464
465.. code-block:: yaml
466
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200467 jenkins:
468 client:
469 job:
470 my_plugin_parametrized_job:
471 plugin_properties:
472 throttleconcurrents:
473 enabled: True
474 max_concurrent_per_node: 3
Vasyl Saienko661acf42018-01-18 10:37:07 +0200475 max_concurrent_total: 1
476 throttle_option: category #one of project (default or category)
477 categories:
478 - my_throuttle_category
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200479 plugin:
Alexander Evseevcd836a12018-07-27 13:02:45 +0200480 throttle-concurrents:
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200481
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300482LDAP configuration (depends on LDAP plugin):
Jakub Josef063a7532017-01-11 15:48:01 +0100483
484.. code-block:: yaml
485
486 jenkins:
487 client:
488 security:
489 ldap:
490 server: 1.2.3.4
491 root_dn: dc=foo,dc=com
492 user_search_base: cn=users,cn=accounts
493 manager_dn: ""
494 manager_password: password
495 user_search: ""
496 group_search_base: ""
497 inhibit_infer_root_dn: false
498
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300499Matrix configuration (depends on auth-matrix plugin):
Jakub Josef063a7532017-01-11 15:48:01 +0100500
501.. code-block:: yaml
502
503 jenkins:
504 client:
505 security:
506 matrix:
Jakub Josef0ee470e2017-01-17 11:46:58 +0100507 # set true for use ProjectMatrixAuthStrategy instead of GlobalMatrixAuthStrategy
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400508 project_based: false
Jakub Josef063a7532017-01-11 15:48:01 +0100509 permissions:
510 Jenkins:
511 # administrator access
512 ADMINISTER:
513 - admin
514 # read access (anonymous too)
515 READ:
516 - anonymous
517 - user1
518 - user2
519 # agents permissions
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400520 MasterComputer:
521 BUILD:
Jakub Josef063a7532017-01-11 15:48:01 +0100522 - user3
523 # jobs permissions
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400524 hudson:
Jakub Josef063a7532017-01-11 15:48:01 +0100525 model:
526 Item:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400527 BUILD:
Jakub Josef063a7532017-01-11 15:48:01 +0100528 - user4
529
530`Common matrix strategies <https://github.com/arbabnazar/configuration/blob/c08a5eaf4e04a68d2481375502a926517097b253/playbooks/roles/tools_jenkins/templates/projectBasedMatrixSecurity.groovy.j2>`_
531
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300532Views enforcing from client:
Jakub Josef7bb17ab2017-01-12 14:52:53 +0100533
534.. code-block:: yaml
535
536 jenkins:
537 client:
538 view:
539 my-list-view:
540 enabled: true
541 type: ListView
Jakub Josef7d9fce32017-03-24 16:46:56 +0100542 include_regex: ".*"
Jakub Josef7bb17ab2017-01-12 14:52:53 +0100543 my-view:
544 # set false to disable
545 enabled: true
546 type: MyView
547
548View specific params:
549
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300550- ``include_regex`` for ``ListView`` and ``CategorizedJobsView``
551- categories for ``CategorizedJobsView``
Jakub Josef7d9fce32017-03-24 16:46:56 +0100552
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300553Categorized views:
Jakub Josef7d9fce32017-03-24 16:46:56 +0100554
555.. code-block:: yaml
556
557 jenkins:
558 client:
559 view:
560 my-categorized-view:
561 enabled: true
562 type: CategorizedJobsView
563 include_regex: ".*"
564 categories:
565 - group_regex: "aptly-.*-nightly-testing"
566 naming_rule: "Nightly -> Testing"
567 - group_regex: "aptly-.*-nightly-production"
568 naming_rule: "Nightly -> Production"
Jakub Josef7bb17ab2017-01-12 14:52:53 +0100569
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300570Credentials enforcing from client:
Jakub Josef123be7a2016-12-12 16:02:36 +0100571
572.. code-block:: yaml
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200573
Jakub Josef123be7a2016-12-12 16:02:36 +0100574 jenkins:
575 client:
576 credential:
577 cred_first:
578 username: admin
579 password: password
580 cred_second:
581 username: salt
582 password: password
583 cred_with_key:
584 username: admin
585 key: SOMESSHKEY
Sergey Otpuschennikov1dd77992018-06-27 11:11:07 +0400586 cred_with_text_secret:
587 secret: SOMETEXTSECRET
Yuriy Taraday2e21e3c2018-02-06 20:17:58 +0400588 cred_with_secret_file:
589 filename: somefile.json
590 content: |
591 { "Hello": "world!" }
Jakub Josef123be7a2016-12-12 16:02:36 +0100592
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300593Users enforcing from client:
Jakub Josef123be7a2016-12-12 16:02:36 +0100594
595.. code-block:: yaml
596
597 jenkins:
598 client:
599 user:
600 admin:
601 password: admin_password
602 admin: true
603 user01:
604 password: user_password
605
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300606Node enforcing from client using JNLP launcher:
Jakub Josef123be7a2016-12-12 16:02:36 +0100607
608.. code-block:: yaml
609
610 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100611 client:
612 node:
613 node01:
614 remote_home: /remote/home/path
615 desc: node-description
616 num_executors: 1
617 node_mode: Normal
618 ret_strategy: Always
619 labels:
620 - example
621 - label
622 launcher:
623 type: jnlp
Jakub Josef123be7a2016-12-12 16:02:36 +0100624
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300625Node enforcing from client using SSH launcher:
Jakub Josef123be7a2016-12-12 16:02:36 +0100626
627.. code-block:: yaml
628
629 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100630 client:
631 node:
632 node01:
633 remote_home: /remote/home/path
634 desc: node-description
635 num_executors: 1
636 node_mode: Normal
637 ret_strategy: Always
638 labels:
639 - example
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200640 - label
Ales Komarekffe8bb22017-02-09 11:10:16 +0100641 launcher:
642 type: ssh
643 host: test-launcher
644 port: 22
645 username: launcher-user
646 password: launcher-pass
Jakub Josef123be7a2016-12-12 16:02:36 +0100647
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300648Configure Jenkins master:
Jakub Josef1bb7f442017-05-26 17:02:56 +0200649
650.. code-block:: yaml
651
652 jenkins:
653 client:
654 node:
655 master:
656 num_executors: 1
657 node_mode: Normal # or Exclusive
658 labels:
659 - example
660 - label
661
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300662Setting node labels:
Jakub Josef123be7a2016-12-12 16:02:36 +0100663
664.. code-block:: yaml
665
666 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100667 client:
668 label:
669 node-name:
670 lbl_text: label-offline
671 append: false # set true for label append instead of replace
Jakub Josefd8e04292016-11-28 18:02:27 +0100672
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300673SMTP server settings from client:
Jakub Josef60cc9d22017-01-18 12:02:14 +0100674
675.. code-block:: yaml
676
677 jenkins:
678 client:
679 smtp:
680 host: "smtp.domain.com"
681 username: "user@domain.cz"
682 password: "smtp-password"
683 port: 25
684 ssl: false
685 reply_to: reply_to@address.com
686
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300687Jenkins admin user email enforcement from client:
Jakub Josefdfb288c2017-04-27 17:29:00 +0200688
689.. code-block:: yaml
690
691 jenkins:
692 client:
693 smtp:
694 admin_email: "My Jenkins <jenkins@myserver.com>"
695
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300696Slack plugin configuration:
Jakub Josefa6d4c832017-01-19 14:06:12 +0100697
698.. code-block:: yaml
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400699
Jakub Josefa6d4c832017-01-19 14:06:12 +0100700 jenkins:
701 client:
702 slack:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100703 team_domain: example.com
704 token: slack-token
705 room: slack-room
Jakub Josef6e0cda92017-02-14 18:01:58 +0100706 token_credential_id: cred_id
Ales Komarekffe8bb22017-02-09 11:10:16 +0100707 send_as: Some slack user
Jakub Josefa6d4c832017-01-19 14:06:12 +0100708
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300709Pipeline global libraries setup:
Jakub Josef6e0cda92017-02-14 18:01:58 +0100710
711.. code-block:: yaml
712
713 jenkins:
714 client:
715 lib:
716 my-pipeline-library:
717 enabled: true
718 url: https://path-to-my-library
719 credential_id: github
720 branch: master # optional, default master
721 implicit: true # optional default true
Jakub Josefd8e04292016-11-28 18:02:27 +0100722
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300723Artifactory server enforcing:
Jakub Josef01940252017-05-10 14:01:22 +0200724
725.. code-block:: yaml
726
727 jenkins:
728 client:
729 artifactory:
730 my-artifactory-server:
731 enabled: true
732 url: https://path-to-my-library
733 credential_id: github
734
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300735Jenkins Global env properties enforcing:
Jakub Josef184ee1c2017-11-29 16:03:09 +0100736
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400737.. code-block:: yaml
Jakub Josef184ee1c2017-11-29 16:03:09 +0100738
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400739 jenkins:
740 client:
741 globalenvprop:
742 OFFLINE_DEPLOYMENT:
743 enabled: true
744 name: "OFFLINE_DEPLOYMENT" # optional, default using dict key
745 value: "true"
Jakub Josef184ee1c2017-11-29 16:03:09 +0100746
Dmitry Burmistrova3f2c132018-04-10 16:24:25 +0400747Throttle categories management from client (requires
748`Throttle Concurrent Builds <https://plugins.jenkins.io/throttle-concurrents>`_
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300749plugin):
Dmitry Burmistrova3f2c132018-04-10 16:24:25 +0400750
751.. code-block:: yaml
752
753 jenkins:
754 client:
755 throttle_category:
756 'My First Category':
757 max_total: 2
758 max_per_node: 1
759 'My Second Category':
760 max_total: 5
761 max_per_node: 2
762 max_per_label:
763 'node_label_1': 1
764 'node_label_2': 2
765 'My Category To Remove:
766 enabled: false
767
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400768Jira sites management from client (requires
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300769`JIRA <https://plugins.jenkins.io/jira>`_ plugin):
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400770
771.. code-block:: yaml
772
773 # Remove all sites
774 jenkins:
775 client:
776 jira:
777 enabled: False
778
779.. code-block:: yaml
780
781 jenkins:
782 client:
783 jira:
784 sites:
785 'http://my.jira.site/':
786 link_url: 'http://alternative.link/'
787 http_auth: false
788 use_wiki_notation: false
789 record_scm: false
790 disable_changelog: false
791 issue_pattern: ''
792 any_build_result: false
793 user: 'username'
794 password: 'passwd'
795 conn_timeout: 10
796 visible_for_group: ''
797 visible_for_project: ''
798 timestamps: false
799 timestamp_format: ''
Sergey Otpuschennikov74ea2682018-05-21 16:35:36 +0400800
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300801Gerrit trigger plugin configuration:
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400802
803.. code-block:: yaml
804
805 jenkins:
806 client:
807 gerrit:
808 server1:
809 host: "gerrit.domain.local"
810 port: 29418
811 username: "jenkins"
812 email: "jenkins@domain.local"
813 auth_key_file: "/var/jenkins_home/.ssh/id_rsa"
814 frontendURL: "https://gerrit.domain.local"
Sergey Otpuschennikov107c1962018-06-20 13:45:04 +0400815 build_current_patches_only: true
816 abort_new_patchsets: false
817 abort_manual_patchsets: false
818 abort_same_topic: false
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400819 authkey: |
820 SOMESSHKEY
821 server2:
822 host: "gerrit2.domain.local"
823 port: 29418
824 username: "jenkins"
825 email: "jenkins@domain.local"
826 auth_key_file: "/var/jenkins_home/.ssh/id_rsa"
827 frontendURL: "https://gerrit2.domain.local"
Sergey Otpuschennikov107c1962018-06-20 13:45:04 +0400828 build_current_patches_only: true
829 abort_new_patchsets: false
830 abort_manual_patchsets: false
831 abort_same_topic: false
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400832 authkey: |
833 SOMESSHKEY
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400834
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300835CSRF Protection configuration:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400836
837.. code-block:: yaml
838
839 jenkins:
840 client:
841 security:
842 csrf:
843 enabled: true
844 proxy_compat: false
845
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300846Agent to Master Access Control:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400847
848.. code-block:: yaml
849
850 jenkins:
851 client:
852 security:
853 agent2master:
854 enabled: true
855 whitelisted: ''
856 file_path_rules: ''
857
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300858Content Security Policy configuration:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400859
860.. code-block:: yaml
861
862 jenkins:
863 client:
864 security:
865 csp: "sandbox; default-src 'none'; img-src 'self'; style-src 'self';"
866
Ales Komarek4c0bab12016-01-22 12:10:50 +0100867Usage
868=====
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200869
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300870#. Generate password hash:
Ales Komarek4c0bab12016-01-22 12:10:50 +0100871
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300872 .. code-block:: bash
Ales Komarek4c0bab12016-01-22 12:10:50 +0100873
874 echo -n "salt{plainpassword}" | openssl dgst -sha256
875
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300876#. Place in the configuration ``salt:hashpassword``.
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200877
Ales Komarekffe8bb22017-02-09 11:10:16 +0100878
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300879Read more
880=========
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200881
882* https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100883
884Documentation and Bugs
885======================
886
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300887* http://salt-formulas.readthedocs.io/
888 Learn how to install and update salt-formulas
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100889
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300890* https://github.com/salt-formulas/salt-formula-jenkins/issues
891 In the unfortunate event that bugs are discovered, report the issue to the
892 appropriate issue tracker. Use the Github issue tracker for a specific salt
893 formula
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100894
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300895* https://launchpad.net/salt-formulas
896 For feature requests, bug reports, or blueprints affecting the entire
897 ecosystem, use the Launchpad salt-formulas project
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100898
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300899* https://launchpad.net/~salt-formulas-users
900 Join the salt-formulas-users team and subscribe to mailing list if required
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100901
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300902* https://github.com/salt-formulas/salt-formula-jenkins
903 Develop the salt-formulas projects in the master branch and then submit pull
904 requests against a specific formula
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100905
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300906* #salt-formulas @ irc.freenode.net
907 Use this IRC channel in case of any questions or feedback which is always
908 welcome
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100909