You can export any object such as a pipeline, application or microservice, environments, release, and so on, to a DSL file to represent its definition as code. You can then store the file in a source code repository of your choice.
The DSL-based representation of any object lets you recreate that state of the object at any point. For example, let’s say you have a pipeline named Heatclinic pipeline DSL and you want to be able to recreate its current state at any point in the future. Using the DSL Export feature, you can export the current definition for this pipeline as code to a DSL file.
Select DSL Export from the actions menu. The Export DSL menu displays.
Select options from the Export DSL menu as required.
Select to suppress both object and custom properties with null values in the exported DSL. If not selected, all properties are returned, subject to the Suppress Defaults setting.
To override null values for custom properties from being suppressed, set the server setting,
disableNotSuppressNullsOption, to true:
ectool setProperty /server/settings/disableNotSuppressNullsOption true
Select to suppress object and custom properties with default values in the exported DSL.
Select to exclude the object’s parent references in the exported DSL.
Select to include each object’s access control list in the exported DSL.
Options for child objects
These options control how the hierarchy is stored in the file structure.
Include All Child Objects
Select to include all child objects in the top-level object hierarchy specified by <object name>.
If not selected, the Child Object Types to Include box opens. Enter a comma-separated list of child object types to include.
Use the describeObjectTypeStructure command to get a list of the hierarchy for a given top-level object type. Browse the hierarchy for the child object of interest and use its
objectType.collectionNameas the value to include in the comma-separated list.
Include all Child Objects in a Single DSL File
Select to include all child objects into a single DSL file.
If not selected, the Child Object Types to Export to Separate DSL files box opens. Enter a comma-separated list of child object types.
Wildcard characters are accepted.
Qualify the object as needed to uniquely specify it.
See Specifying child object lists for more details about specifying lists.
Select Export to initiate the DSL export. The DSL file is downloaded into a file on your local system.
Commit this version of the DSL file into your source code repository.
This DSL file has all the details of the pipeline stages, gates, and tasks. It also retains references to the snapshots used for deployments in various stages of this pipeline.
Snapshots capture references to the exact versions of the artifacts, configurations, and so on. This lets you recreate the exact state of the pipeline at any point in the future for various scenarios. To recreate a pipeline, you check out that DSL file and evaluate the DSL using either the
While this example showcases pipeline objects, the DSL export functionality is available from most CloudBees CD/RO objects.
This method is limited to the following object types: Applications, microservices, environments, master components, environment and resource templates, reports, releases, and pipelines.
ectool generateDsl <path> [optionals] API command to generate an XML file representing the contents of a CloudBees CD/RO object. See the generateDsl command for full syntax and examples.
To generate DSL scripts representing the contents of an entire CloudBees CD/RO object structure including all nested objects, parameters, and custom properties, use the export DSL catalog item available with the CloudBees CD/RO UI. This method is available for all CloudBees CD/RO object types.
The scripts are organized in a file structure suitable for importing back into the object structure. In this way, you can use the corresponding Import DSL service catalog item to easily create new objects based on the existing object structure or to override the original object structure.