configuration-as-code-plugin/demos/jenkins
Ilya Pyatizbyantsev d6c1c3f184
Clarifying documentation (#2382)
* Clarifying documentation (#2287)
In the "implementation note" block in demos/jenkins/README.md

* Update demos/jenkins/README.md

Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com>

---------

Co-authored-by: Hervé Le Meur <91831478+lemeurherve@users.noreply.github.com>
2023-10-07 10:32:01 +01:00
..
README.md Clarifying documentation (#2382) 2023-10-07 10:32:01 +01:00
jenkins.yaml doc: update Docker Cloud examples (#1960) 2022-04-25 08:28:42 +01:00

README.md

configure jenkins

Basic Jenkins configuration under Configure System, which is not a part of any plugin

Many of the plugins are actually configured in the same section, but to configure them you'll put their configuration under unclassified root element - details in plugin's specific subfolders.

jenkins.yaml file is an example of a configuration file with Jenkins and a number of plugins configured.

sample configuration

jenkins:
  systemMessage: "Jenkins configured automatically by Jenkins Configuration as Code plugin\n\n"
  numExecutors: 5
  scmCheckoutRetryCount: 2
  mode: NORMAL

Multiline system message

There are (too) many ways to write multi-line strings in YAML, but one of the most readable solutions is to use the following syntax, that doesn't need escaped newlines and other shenanigans:

jenkins:
  systemMessage: |
    Welcome to our build server.

    This Jenkins is 100% configured and managed 'as code'.
    Config is now mostly handled by the 'Jenkins Configuration as Code' (JCasC) plugin.
    JCasC config can be found in the jenkins.yaml file in the $JENKINS_HOME/casc/ folder.

    Some settings are still injected from init.groovy.d scripts,
    but these settings will be ported over to JCasC as support becomes available.    
  numExecutors: 1 # This is just a random example entry to show that there is no "end token" for the multiline string apart from un-indent to the next YAML property.

implementation note

The example above is only a subset of commonly used settings. The full list is available in the generated documentation by clicking on the Documentation link at the bottom of the Configuration as Code page in your Jenkins instance.