GoCD plugin to keep pipelines and environments configuration in source-control in Jsonnet. See this document to find out what are GoCD configuration repositories.
This is the third GoCD configuration plugin, which builds off of the YAML configuration plugin
- Format is extensible - you can use libraries and functions to build your configuration
- Format is concise - you can use variables, functions, and imports to keep your configuration DRY
- Format is powerful - you can use conditionals, comprehensions, and other language features to build your configuration
Step 1: You need to install the plugin in the GoCD server. Download it from
the releases page and place it on the GoCD server in
plugins/external
directory.
Step 2: Follow the GoCD documentation to add a new configuration repository.
You can use the example repository at: https://github.com/getsentry/gocd-jsonnet-config-example.git
.
The default pattern is **/*.jsonnet,**/jsonnetfile.json
, which will recursively search the entire repository for all files ending with .jsonnet
and files named jsonnetfile.json
. While jsonnetfile.json
is not a valid jsonnet file, it is used to specify dependencies for the jsonnet files. See jsonnet-bundler for more information. If there are no external dependencies, you can omit the jsonnetfile.json
file.
You can set a custom file pattern per configuration repository using the GoCD configuration UI:
Or in the config XML using <configuration>
:
<config-repos>
<config-repo pluginId="jsonnet.config.plugin" id="repo1">
<git url="https://github.com/getsentry/gocd-jsonnet-config-plugin.git" />
<configuration>
<property>
<key>file_pattern</key>
<!-- comma-separate multiple patterns -->
<value>pipelines/build/*.jsonnet,pipelines/lint/*.jsonnet</value>
</property>
</configuration>
</config-repo>
</config-repos>
Please note this brief overview of what is done by the plugin:
- parsing jsonnet into json when GoCD server asks for it.
And this is done by the GoCD server:
- complex logic merging multiple config repo sources and XML
- validation of pipelines/stages/jobs/tasks domain
- any UI rendering
To build and test this plugin, you'll need java jdk >= 11.
If you have local java environment, then you may run all tests and create a ready to use jar with:
./gradlew test jar
We use semantic versioning.