configuration-as-code-plugin/demos/jenkins
Joseph Petersen 410c3ae03e
SecretResolver support file and base64 variable expansion (#1408)
Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
2020-07-19 04:37:52 +02:00
..
README.md 🗑️ Codacy markdown issues (#848) 2019-04-20 15:50:58 +02:00
jenkins.yaml SecretResolver support file and base64 variable expansion (#1408) 2020-07-19 04:37:52 +02: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.