Built over the Jenkins Configuration as Code plugin, CloudBees Configuration as Code (CasC) is a method of simplifying the configuration of the operations center or controllers by capturing the configuration of the CloudBees CI instance in human-readable declarative YAML files that can be used in a reproducible way.
The set of YAML files that describe a CloudBees CI instance configuration is a Bundle, and in addition to the features provided by the Jenkins Configuration as Code plugin, CloudBees Configuration as Code (CasC) offers the following features:
-
Bundles can contain additional configuration information for:
-
Items like folders, pipelines, freestyle jobs, etc.
-
Plugins to be installed (under the CloudBees Assurance Program(CAP) or using plugin catalogs).
-
RBAC (Role-Based Access Control) configurations with users, groups, and roles.
-
Bundle Inheritance is possible when your operations center provides CasC configuration bundles to your controllers.
-
CasC advantages
The use of CloudBees Configuration as Code (CasC) provides the following advantages to your organization:
-
Portability: Storing all your CasC configuration bundles makes moving your CloudBees CI cluster to a new infrastructure easier.
-
Auditability and Traceability: Using an SCM as a single source of truth for your CasC configuration bundles adds traceability to any change.
-
Manageability: Using your operations center, you can manage the configuration bundles applied to the different controllers in your cluster. CloudBees Configuration as Code (CasC) even allows you to validate a bundle before applying it (pre-validation).
-
Scalability: When you create new controllers in your cluster to match an increasing workload, CloudBees Configuration as Code (CasC) makes this horizontal scaling easier, allowing you to create a new controller with the required configuration stored in a configuration bundle.
CasC bundles
The main element when using Configuration as Code (CasC) to configure your CloudBees CI instance (operations center or controller) is the CasC bundle. A CasC bundle is a collection of YAML files that describes the configuration of a CloudBees CI instance.
Typically, these files may be part of a CasC bundle:
-
bundle.yaml: This index file that describes the bundle and references the other files in the bundle.
-
jenkins.yaml: This file contains the Jenkins configuration, as defined by the Configuration as Code plugin.
-
plugins.yaml: (Optional) This file contains a list of all plugins that should be installed.
-
plugin-catalog.yaml: (Optional) This file contains the plugin catalog definitions that should be created on the controller. It’s only part of a CasC bundle for bundles describing a controller configuration.
-
items.yaml: (Optional) This file contains the items to be created.
-
rbac.yaml: (Optional) This file contains all role-based access control (RBAC) groups and roles defined at the root level.
-
variables.yaml: (Optional) This file defines the variables that can be used in the
jenkins.yaml
,items.yaml
, andrbac.yaml
files.
CasC bundles can be created in two ways:
-
Manually, creating from scratch the files listed above.
-
Exporting from a CloudBees CI instance by means of the CloudBees Configuration as Code export and update screen in the UI, or an API HTTP request.
To learn about these files, refer to:
Once the CasC bundles are created, manually or by exporting the configuration for a running CloudBees CI instance, to configure an instance using them, bundles can be placed:
-
In a local folder within the instance you want to configure using the bundle.
-
In an SCM that will provide the bundle to configure your instance.
CasC use cases
CloudBees Configuration as Code (CasC) can be used in many different scenarios and ways. Some common use cases are described below:
-
You can easily add a new controller to your CloudBees CI cluster using the same configuration as other controllers in your cluster. A 1-to-many configuration.
-
You can easily reuse your current CloudBees CI cluster configuration when moving your cluster to a new infrastructure with higher capacities.
-
When many controllers are configured using the same CasC bundle, you can easily update them all at once, propagating those changes from the operations center serving the bundle to all the controllers using it.
-
You can speed up onboarding for new teams in your organization by having controller bundles with all they need ready to be used.
-
Using the bundle inheritance feature, you can create new CasC bundles based on others.
-
You can store CasC bundles to recover your CloudBees CI instance in case of disaster.
-
In a CloudBees CI on modern cloud platforms, you can even configure your whole cluster in a single step by using CasC bundles for the operations center containing information about the CasC bundles needed for all the managed controllers. It’s a One-Shot configuration.