blob: 869ea5bf08721b310d06686abec7c07473f8257f [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
Jakub Josef123be7a2016-12-12 16:02:36 +0100588
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300589Users enforcing from client:
Jakub Josef123be7a2016-12-12 16:02:36 +0100590
591.. code-block:: yaml
592
593 jenkins:
594 client:
595 user:
596 admin:
597 password: admin_password
598 admin: true
599 user01:
600 password: user_password
601
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300602Node enforcing from client using JNLP launcher:
Jakub Josef123be7a2016-12-12 16:02:36 +0100603
604.. code-block:: yaml
605
606 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100607 client:
608 node:
609 node01:
610 remote_home: /remote/home/path
611 desc: node-description
612 num_executors: 1
613 node_mode: Normal
614 ret_strategy: Always
615 labels:
616 - example
617 - label
618 launcher:
619 type: jnlp
Jakub Josef123be7a2016-12-12 16:02:36 +0100620
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300621Node enforcing from client using SSH launcher:
Jakub Josef123be7a2016-12-12 16:02:36 +0100622
623.. code-block:: yaml
624
625 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100626 client:
627 node:
628 node01:
629 remote_home: /remote/home/path
630 desc: node-description
631 num_executors: 1
632 node_mode: Normal
633 ret_strategy: Always
634 labels:
635 - example
Vasyl Saienkocb928a82018-01-17 15:21:28 +0200636 - label
Ales Komarekffe8bb22017-02-09 11:10:16 +0100637 launcher:
638 type: ssh
639 host: test-launcher
640 port: 22
641 username: launcher-user
642 password: launcher-pass
Jakub Josef123be7a2016-12-12 16:02:36 +0100643
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300644Configure Jenkins master:
Jakub Josef1bb7f442017-05-26 17:02:56 +0200645
646.. code-block:: yaml
647
648 jenkins:
649 client:
650 node:
651 master:
652 num_executors: 1
653 node_mode: Normal # or Exclusive
654 labels:
655 - example
656 - label
657
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300658Setting node labels:
Jakub Josef123be7a2016-12-12 16:02:36 +0100659
660.. code-block:: yaml
661
662 jenkins:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100663 client:
664 label:
665 node-name:
666 lbl_text: label-offline
667 append: false # set true for label append instead of replace
Jakub Josefd8e04292016-11-28 18:02:27 +0100668
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300669SMTP server settings from client:
Jakub Josef60cc9d22017-01-18 12:02:14 +0100670
671.. code-block:: yaml
672
673 jenkins:
674 client:
675 smtp:
676 host: "smtp.domain.com"
677 username: "user@domain.cz"
678 password: "smtp-password"
679 port: 25
680 ssl: false
681 reply_to: reply_to@address.com
682
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300683Jenkins admin user email enforcement from client:
Jakub Josefdfb288c2017-04-27 17:29:00 +0200684
685.. code-block:: yaml
686
687 jenkins:
688 client:
689 smtp:
690 admin_email: "My Jenkins <jenkins@myserver.com>"
691
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300692Slack plugin configuration:
Jakub Josefa6d4c832017-01-19 14:06:12 +0100693
694.. code-block:: yaml
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400695
Jakub Josefa6d4c832017-01-19 14:06:12 +0100696 jenkins:
697 client:
698 slack:
Ales Komarekffe8bb22017-02-09 11:10:16 +0100699 team_domain: example.com
700 token: slack-token
701 room: slack-room
Jakub Josef6e0cda92017-02-14 18:01:58 +0100702 token_credential_id: cred_id
Ales Komarekffe8bb22017-02-09 11:10:16 +0100703 send_as: Some slack user
Jakub Josefa6d4c832017-01-19 14:06:12 +0100704
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300705Pipeline global libraries setup:
Jakub Josef6e0cda92017-02-14 18:01:58 +0100706
707.. code-block:: yaml
708
709 jenkins:
710 client:
711 lib:
712 my-pipeline-library:
713 enabled: true
714 url: https://path-to-my-library
715 credential_id: github
716 branch: master # optional, default master
717 implicit: true # optional default true
Jakub Josefd8e04292016-11-28 18:02:27 +0100718
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300719Artifactory server enforcing:
Jakub Josef01940252017-05-10 14:01:22 +0200720
721.. code-block:: yaml
722
723 jenkins:
724 client:
725 artifactory:
726 my-artifactory-server:
727 enabled: true
728 url: https://path-to-my-library
729 credential_id: github
730
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300731Jenkins Global env properties enforcing:
Jakub Josef184ee1c2017-11-29 16:03:09 +0100732
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400733.. code-block:: yaml
Jakub Josef184ee1c2017-11-29 16:03:09 +0100734
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400735 jenkins:
736 client:
737 globalenvprop:
738 OFFLINE_DEPLOYMENT:
739 enabled: true
740 name: "OFFLINE_DEPLOYMENT" # optional, default using dict key
741 value: "true"
Jakub Josef184ee1c2017-11-29 16:03:09 +0100742
Dmitry Burmistrova3f2c132018-04-10 16:24:25 +0400743Throttle categories management from client (requires
744`Throttle Concurrent Builds <https://plugins.jenkins.io/throttle-concurrents>`_
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300745plugin):
Dmitry Burmistrova3f2c132018-04-10 16:24:25 +0400746
747.. code-block:: yaml
748
749 jenkins:
750 client:
751 throttle_category:
752 'My First Category':
753 max_total: 2
754 max_per_node: 1
755 'My Second Category':
756 max_total: 5
757 max_per_node: 2
758 max_per_label:
759 'node_label_1': 1
760 'node_label_2': 2
761 'My Category To Remove:
762 enabled: false
763
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400764Jira sites management from client (requires
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300765`JIRA <https://plugins.jenkins.io/jira>`_ plugin):
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400766
767.. code-block:: yaml
768
769 # Remove all sites
770 jenkins:
771 client:
772 jira:
773 enabled: False
774
775.. code-block:: yaml
776
777 jenkins:
778 client:
779 jira:
780 sites:
781 'http://my.jira.site/':
782 link_url: 'http://alternative.link/'
783 http_auth: false
784 use_wiki_notation: false
785 record_scm: false
786 disable_changelog: false
787 issue_pattern: ''
788 any_build_result: false
789 user: 'username'
790 password: 'passwd'
791 conn_timeout: 10
792 visible_for_group: ''
793 visible_for_project: ''
794 timestamps: false
795 timestamp_format: ''
Sergey Otpuschennikov74ea2682018-05-21 16:35:36 +0400796
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300797Gerrit trigger plugin configuration:
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400798
799.. code-block:: yaml
800
801 jenkins:
802 client:
803 gerrit:
804 server1:
805 host: "gerrit.domain.local"
806 port: 29418
807 username: "jenkins"
808 email: "jenkins@domain.local"
809 auth_key_file: "/var/jenkins_home/.ssh/id_rsa"
810 frontendURL: "https://gerrit.domain.local"
Sergey Otpuschennikov107c1962018-06-20 13:45:04 +0400811 build_current_patches_only: true
812 abort_new_patchsets: false
813 abort_manual_patchsets: false
814 abort_same_topic: false
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400815 authkey: |
816 SOMESSHKEY
817 server2:
818 host: "gerrit2.domain.local"
819 port: 29418
820 username: "jenkins"
821 email: "jenkins@domain.local"
822 auth_key_file: "/var/jenkins_home/.ssh/id_rsa"
823 frontendURL: "https://gerrit2.domain.local"
Sergey Otpuschennikov107c1962018-06-20 13:45:04 +0400824 build_current_patches_only: true
825 abort_new_patchsets: false
826 abort_manual_patchsets: false
827 abort_same_topic: false
Sergey Otpuschennikov83996702017-11-23 17:10:57 +0400828 authkey: |
829 SOMESSHKEY
Dmitry Burmistrov429b8ec2018-04-25 17:13:48 +0400830
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300831CSRF Protection configuration:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400832
833.. code-block:: yaml
834
835 jenkins:
836 client:
837 security:
838 csrf:
839 enabled: true
840 proxy_compat: false
841
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300842Agent to Master Access Control:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400843
844.. code-block:: yaml
845
846 jenkins:
847 client:
848 security:
849 agent2master:
850 enabled: true
851 whitelisted: ''
852 file_path_rules: ''
853
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300854Content Security Policy configuration:
Dmitry Burmistrov2953edf2018-05-24 11:32:54 +0400855
856.. code-block:: yaml
857
858 jenkins:
859 client:
860 security:
861 csp: "sandbox; default-src 'none'; img-src 'self'; style-src 'self';"
862
Ales Komarek4c0bab12016-01-22 12:10:50 +0100863Usage
864=====
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200865
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300866#. Generate password hash:
Ales Komarek4c0bab12016-01-22 12:10:50 +0100867
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300868 .. code-block:: bash
Ales Komarek4c0bab12016-01-22 12:10:50 +0100869
870 echo -n "salt{plainpassword}" | openssl dgst -sha256
871
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300872#. Place in the configuration ``salt:hashpassword``.
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200873
Ales Komarekffe8bb22017-02-09 11:10:16 +0100874
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300875Read more
876=========
Filip Pytloun8bfd2bf2015-10-06 16:28:32 +0200877
878* https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100879
880Documentation and Bugs
881======================
882
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300883* http://salt-formulas.readthedocs.io/
884 Learn how to install and update salt-formulas
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100885
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300886* https://github.com/salt-formulas/salt-formula-jenkins/issues
887 In the unfortunate event that bugs are discovered, report the issue to the
888 appropriate issue tracker. Use the Github issue tracker for a specific salt
889 formula
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100890
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300891* https://launchpad.net/salt-formulas
892 For feature requests, bug reports, or blueprints affecting the entire
893 ecosystem, use the Launchpad salt-formulas project
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100894
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300895* https://launchpad.net/~salt-formulas-users
896 Join the salt-formulas-users team and subscribe to mailing list if required
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100897
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300898* https://github.com/salt-formulas/salt-formula-jenkins
899 Develop the salt-formulas projects in the master branch and then submit pull
900 requests against a specific formula
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100901
OlgaGusarenkof20d94d2018-07-30 18:48:25 +0300902* #salt-formulas @ irc.freenode.net
903 Use this IRC channel in case of any questions or feedback which is always
904 welcome
Filip Pytlounadf72fa2017-02-02 13:02:03 +0100905