There are three ways to generate DSL scripts, based on your needs:
Through the DSL IDE: a general purpose DSL editor
Through the object editor: best for Single objects
Through the Export DSL catalog item: best for object hierarchies
You can export any object such as a pipeline, application, microservice, environment, or release to a DSL file. This file can then be stored in the source code repository of your choice. This DSL-based representation of an object lets you recreate the state of the object.
To export an object into DSL:
Select DSL Export from the object’s three-line menu. The Export DSL screen displays.Figure 1. Export DSL
Select export options.
Select a language format for DSL export. Choices are:
YAML DSL format is a Preview feature.A Preview feature:
Has not undergone end-to-end testing with CloudBees products
Is provided without service-level agreements (SLA) and therefore does not include CloudBees' commitment on functionality or performance
May impact other stable areas of the product when used
May have limited documentation
May not be feature complete during the Preview period
May graduate from preview state to fully supported or be removed from the product
May introduce incompatible, backward-breaking changes that could revoke the ability to upgrade
Product features and documentation are frequently updated. If you find an issue or have a suggestion, please contact CloudBees Support.
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 exclude the object’s parent references in the exported DSL.
Select to suppress object and custom properties with default values 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.
Select to exclude fields with child values in the exported DSL.
Select Export to initiate the DSL export. The DSL file is downloaded to 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.