Skip to main content
In this lesson you’ll learn how to use the Jenkins Configuration as Code (JCasC) plugin to declaratively create pipeline jobs and configure tools (for example, Node.js). We cover:
  • Where to find JCasC demo YAML and examples
  • How to add tool and job definitions to your JCasC YAML
  • How to resolve a common “No configurator for jobs” error (installing the Job DSL plugin)
  • How to apply the configuration and verify created jobs and tools
JCasC has many example configurations in the plugin repository demos directory. These demos are helpful starting points for configuring authentication, clouds, tools, jobs, views, and more.
A dark-themed GitHub repository view showing the "configuration-as-code-plugin" demos directory with a list of demo subfolders and recent commit messages on the right. A file tree and navigation sidebar are visible on the left.

Example snippets from the demos

Below are representative YAML fragments you will commonly use or adapt when authoring your jenkins-casc.yaml. Example: set Jenkins location (unclassified section)
Example: Kubernetes cloud configuration (relevant fields)
Example: declare a Node.js tool installation via JCasC

Where to place your JCasC file

Edit your controller’s JCasC YAML file. In this lesson the configuration file is: /var/lib/jenkins/JENKINS_BACKUP/jenkins-casc.yaml Your YAML may already contain many sections (credentials, views, plugin configs, etc.). For example, a credentials fragment might look like:

Adding jobs via JCasC (requires Job DSL plugin)

JCasC delegates top-level jobs: configuration to the Job DSL configurator. This means your YAML can include embedded Job DSL scripts under a jobs: root. Example:
This configuration creates:
  • a folder named testjobs
  • a pipeline job testjobs/default-agent with a minimal pipeline that echoes “hello”
If you attempt to apply YAML containing jobs: before the Job DSL plugin is installed, JCasC will fail because the jobs configurator is not available.
A screenshot of the Jenkins "Configuration as Code" admin page showing the config source path (/var/lib/jenkins/JENKINS_BACKUP/jenkins-casc.yaml) and a red error: "No configurator for the following root elements: jobs." The page also shows buttons to apply, reload, download, and view configuration.
Here is the essential exception you may see:
If JCasC reports “No configurator for the following root elements: jobs”, install the Job DSL plugin first. JCasC requires the Job DSL configurator to process any jobs: roots in your YAML.

Installing the Job DSL plugin

To resolve the error, install the Job DSL plugin:
  • Dashboard -> Manage Jenkins -> Manage Plugins -> Available -> search for “Job DSL” -> install.
The plugin UI looks like this:
A screenshot of the Jenkins "Plugins" management page showing the "Available plugins" view with "Job DSL" selected. The plugin details (version, description and an adoption notice) and install controls are visible in the UI.
After installing the Job DSL plugin, reload or re-apply your JCasC configuration so the new configurator is available and JCasC can process the jobs: root.
The Job DSL plugin must be installed before JCasC can apply job definitions under the jobs: root. If you add job definitions first, JCasC will report the “No configurator for … jobs” error.

Verify the applied configuration

After a successful apply/reload:
  • Confirm a folder testjobs appears in the Jenkins dashboard.
  • Inside it, confirm a pipeline job default-agent (full name testjobs/default-agent) exists.
  • Open the job and verify the pipeline script matches the Job DSL-defined Groovy pipeline. For example:
  • Verify the Node.js tool under Manage Jenkins -> Global Tool Configuration: you should see NodeJS Latest with the declared version (e.g., 12.11.1).

Quick checklist

Troubleshooting tips

  • If JCasC fails on unknown root elements, confirm the matching plugin that provides the configurator is installed (Job DSL for jobs:; other roots may require their own plugins).
  • If a tool (like NodeJS) is not visible after applying JCasC, check the tool YAML for syntax errors and confirm the installer version ID is valid for your installed tool plugin.
  • Check Manage Jenkins -> Configuration as Code for the current config source and any error messages; review controller logs for full stack traces.
That’s the basic flow for using JCasC to create jobs and configure tools.

Watch Video