Skip to content

Commit cd49d91

Browse files
committed
Improved JCasC setup instructions
1 parent 76ecbbf commit cd49d91

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,36 @@ credentials with the `id` returned by token creator. It should be a a 128-bit lo
313313
314314
### Configuration as Code
315315
316-
There is an easier way to setup GitLab Server configuration on your Jenkins server. Jenkins
317-
Configuration as Code (JCasC) allows you to configure your Jenkins Global Configuration by a simple `yaml` file. If you
318-
use Jenkins Code as Configuration on your Jenkins Instance, you can add the following to your `jenkins.yaml`.
316+
There is an easier way to setup GitLab Server configuration on your Jenkins server. No need for messing around in the UI,
317+
`Jenkins Configuration as Code (JCasC)` or simply `Configuration as Code` Plugin allows you to configure Jenkins
318+
via a `yaml` file. If you are a first time user, you can learn more about JCasC
319+
[here](https://github.com/jenkinsci/configuration-as-code-plugin).
320+
321+
#### Prerequisite:
322+
323+
Installed `Configuration as Code` Plugin on your Jenkins instance.
324+
325+
For installing a new plugin see [doc](https://jenkins.io/doc/book/managing/plugins/).
326+
327+
#### Add configuration YAML:
328+
329+
There are multiple ways to load JCasC yaml file to configure Jenkins:
330+
331+
* JCasC by default searches for a file with the name `jenkins.yaml` in `$JENKINS_ROOT`.
332+
333+
* The JCasC looks for an environment variable `CASC_JENKINS_CONFIG` which contains the path for the configuration `yaml` file.
334+
For example,
335+
336+
* Path to a folder containing a set of config files e.g. `/var/jenkins_home/casc_configs`.
337+
338+
* A full path to a single file e.g. `/var/jenkins_home/casc_configs/jenkins.yaml`.
339+
340+
* A URL pointing to a file served on the web e.g. `https://<your-domain>/jenkins.yaml`.
341+
342+
* You can also set the configuration yaml path in the UI. Go to `<your-jenkins-domain>/configuration-as-code`. Enter
343+
path or URL to `jenkins.yaml` and select `Apply New Configuration`.
344+
345+
To configure your GitLab Server in Jenkins add the following to `jenkins.yaml`:
319346
320347
```yaml
321348
credentials:
@@ -336,8 +363,8 @@ unclassified:
336363
serverUrl: "https://gitlab.com"
337364
```
338365
339-
See handling secrets [section](https://github.com/jenkinsci/configuration-as-code-plugin#handling-secrets) for better
340-
security.
366+
See handling secrets [section](https://github.com/jenkinsci/configuration-as-code-plugin#handling-secrets) in JCasC
367+
documentation for better security.
341368
342369
### Setting up GitLab for jobs
343370

0 commit comments

Comments
 (0)