[JCasC] Evaluation and merging of YAML

22 views
Skip to first unread message

Jonas Lindström

unread,
Nov 5, 2019, 6:37:59 AM11/5/19
to Jenkins Developers
First off, sorry about the crosspost. After posting to Jenkins Users I found the instructions on https://jenkins.io/projects/jcasc/ so I am rephrasing my question and posting here.

The option to use multiple YAML files by specifying a folder path seems very useful, but the documentation is quite sketchy about the details. By trial-and-error, and reading some of the source code I have concluded that the following seems to work:

x.yaml

======

jenkins:

  authorizationStrategy:

    globalMatrix:

      permissions:

      - Overall/Administer:jack

 

y.yaml

======

jenkins:

  authorizationStrategy:

    globalMatrix:

      permissions:

      - Overall/Administer:jill


--> resulting in both jack and jill being administrators. However, this results in a conflict:


a.yaml

======

jenkins:

  numExecutors: 1

 

b.yaml

======

jenkins:

  numExecutors: 2


From what I can gather, merging of YAML *is* supported. Sequences and mappings are merged recursively until successful/failed, whereas scalars in the same position in the config tree are considered as conflicting. Am I on the right track about how this works?


Jon Brohauge

unread,
Nov 6, 2019, 12:39:09 PM11/6/19
to Jenkins Developers
Hi Jonas,

We use multiple yaml-files, however we have split up on "major topics", i.e. all the security stuff in the "security.yaml" file, all the jenkins stuff in the "jenkins.yaml" file and so forth. Naming them conveniently the same as the topic.

Regards,

Jon
Reply all
Reply to author
Forward
0 new messages