Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A groovy script can be used in custom gates and steps, as well as for many configuration values on specific steps or gates. Additionally, a gate or step can be skipped by providing a Precondition groovy script. This page includes some sample scripts for these scenarios. See Pipeline Groovy Variables and Methods for a full listing of the accessible variables and methods in these groovy scripts.

Table of Contents

Custom Gates and Steps

...

The following script uses the setInstanceOverride method to set the deploy target group on the stage for each project in the snapshot with 'Plugin' at the end of the name. This could function as a custom gate or step.

Override deploy target group on all projects with Plugin suffix in name
Code Block
languagegroovy
snapshotProjects=stgexec.getSnapshotProjects();
for(snapshotProject in snapshotProjects)
{
    if(snapshotProject.getProjectName().endsWith("Plugin"))
    {
        stgexecinfo.setInstanceOverride(snapshotProject.getProjectId(), "WEBLOGIC")
    }
}

...