jenkinsci/configuration-as-code-plugin

JCasC templating and inheritance support

Open

#1,066 opened on Sep 16, 2019

View on GitHub
 (8 comments) (13 reactions) (0 assignees)Java (752 forks)auto 404
help wanted

Repository metrics

Stars
 (2,790 stars)
PR merge metrics
 (PR metrics pending)

Description

Currently JCasC does not support YAML templating or inclusion in any means. For example, in https://github.com/oleg-nenashev/demo-jenkins-config-as-code/blob/master/init_scripts/src/main/groovy/scripts/Docker.groovy I create multiple Docker Cloud templates for different agent types. The configuration would be huge and difficult to maintain in JCasC.

I would suggest having an engine similar to what https://github.com/probot/probot-config does using Deepmerge:

  • Independent YAML files can be created for configuration snippets and templates
  • External configuration files can be referenced via _extends notion at any level. Local files or other configuration providers (once implemented) can be referenced
  • JCasC reads references when loading or validating configs

Contributor guide