How to generate CasC plugin-catalog.yaml and plugins.yaml files, including transitive dependencies

1 minute readKnowledge base

Issue

I’m starting to use Configuration as Code (CasC) for Controllers, and I’m finding it’s very time consuming to create the plugin-catalog.yaml and plugins.yaml as part of Creating a CasC bundle for controllers

Resolution

If you find it’s time consuming to generate the plugin-catalog.yaml and plugins.yaml with all of the correct transitive dependencies manually or using a tool you wrote yourself, you can utilize the following tool:

To use this tool:

  1. Go to Manage JenkinsCloudBees Configuration as Code export and update and download the plugins.yaml from your instance you would like to start using CasC with (in this example, saving it to ~/Downloads/plugins.yaml).

  2. Download or clone the repo: https://github.com/kyounger/casc-plugin-dependency-calculation

  3. Follow the README to use the tool to generate your plugin-catalog.yaml and plugins.yaml:

./run.sh -v 2.401.3.3 -f ~/Downloads/plugins.yaml -F ~/casc-bundle/plugins.yaml -c ~/casc-bundle/plugin-catalog.yaml
In offline/air gapped environments, use the -C FILE and -D STRING arguments documented here to generate a plugin catalog with the url: set to your own server hosting the plugin hpi files.

The result of this command will write the output files at the chosen paths, in this case ~/casc-bundle/plugins.yaml and ~/casc-bundle/plugin-catalog.yaml.