Using the Groovy API

DSL editors

2 minute readReference

CloudBees CD provides two different DSL editors:

  • DSL IDE: general purpose DSL editor to easily create and evalute DSL files.

  • DSL inline object editor: available within an object’s visual editor, it provides a convenient way to view or edit the underlying DSL for the object.

Alternatively, use the evalDsl API call to programatically edit DSL code.

DSL IDE

The DSL IDE provides users a platform from which to easily test and evaluate their local DSL files from the CloudBees CD UI.

To access the DSL IDE, select DSL IDE from the DevOps Essentials list on the CloudBees CD main menu. The IDE opens:

The IDE is divided into two sections: the top panel where editing takes place and the bottom panel where the output is displayed. Control the editor with actions across the top of the editing panel.

ActionDescription

Import

Export

Import or export DSL code to or from local storage.

Undo

Redo

Clear

Format

Shortcuts for standard editor actions.

Examples

Seed scripts for several common DSL operations and CloudBees CD objects. Select a script from the pull down to get you started with the selected operation.

When finished editing, select the Run button to evaluate the DSL script. Results appear in the bottom panel.

DSL inline object editor

The DSL inline object editor is available from within the visual editors for application, dashboard, environment, environment template, microservice, pipeline, and release objects. It provides a convenient way to view or edit the underlying DSL for the object. Buttons let you toggle between the object editors and the DSL editor.

The DSL editor simplifies the modeling process, because you can run DSL code from the CloudBees CD Deploy UI rather than using an external IDE or command-line interface via the evalDsl API call. The following example shows how access the DSL editor from the pipeline editor.

dsl inline editor

  1. Navigate to the pipeline object list and select a pipeline. The selected pipeline displays in the pipeline editor.

  2. Select the DSL Editor button from the tools bar. The DSL editor opens in edit mode, displaying the DSL code for the current object.

  3. Make a change to the DSL code and then select the Save button in the upper right corner of the editor pane. Your changes are applied to the object and saved.

  4. Select the Back arrow to return to the pipeline list.