Skip to content

Latest commit

 

History

History
135 lines (86 loc) · 5.15 KB

JOB_COMPONENTS.md

File metadata and controls

135 lines (86 loc) · 5.15 KB

Ontrack plug-in features

Build notifier

Add Ontrack: Build creation in the Post build actions in order to create a build for an existing branch.

Parameters are the project name, the branch name and the name of the build to create. Each parameter can use ${VAR} notations in order to get the value for a VAR environment variable or parameter.

The Ontrack build will be associated with a link to the Jenkins build.

If the Run info checkbox is checked, some run info will be associated with the build, containing the build execution time, the URL of the build and the trigger cause.

Promotion notifier

Add Ontrack: Promoted run creation in the Post build actions in order to promote an existing build.

Parameters are the project name, the branch name, the name of the build to promote and the name of the promotion level. Each parameter can use ${VAR} notations in order to get the value for a VAR environment variable or parameter.

Validation notifier

Add Ontrack: Validation run creation in the Post build actions in order to create a validation run for an existing build.

Parameters are the project name, the branch name, the name of the build to validate and the name of the validation stamp. Each parameter can use ${VAR} notations in order to get the value for a VAR environment variable or parameter.

The status of the validation run depends on the Jenkins's build current result:

Jenkins Ontrack
SUCCESS PASSED
UNSTABLE WARNING
ABORTED INTERRUPTED
Other FAILED

If the Run info checkbox is checked, some run info will be associated with the build, containing the build execution time, the URL of the build and the trigger cause.

Triggers

Use the Ontrack: Trigger to add a trigger which fires the job according to the indicated setup.

DSL step

Add Ontrack: DSL in the Build steps in order to run the Ontrack DSL in the build steps. The build will fail or succeed according to the result of the DSL.

See Ontrack DSL for details about using the Ontrack DSL.

DSL notifier

Add Ontrack: DSL in the Post build actions in order to run the Ontrack DSL in the post build actions.

See Ontrack DSL for details about using the Ontrack DSL.

Parameter

The DSL can be used to allow the computation of a parameter for the running build.

Select Ontrack: Single Parameter in the list of parameters.

Enter a DSL which returns one object and extracts a property of this object using the Value property field. The resulting string will be used as the value for the parameter.

In Declarative Pipeline Syntax, parameters can be specified as in the example below,

    parameters {
        ontrackSingleParam(name: 'RELEASE_NUMBER', description: 'Release number', dsl: "ontrack.branch('PRJ', 'BRANCH')", valueProperty: 'name')
    }

and then used as in the example below.

    params.RELEASE_NUMBER

Parameter choice

The DSL can be used to allow the selection among a list of values computed by the DSL.

Select Ontrack: Parameter Choice in the list of parameters.

Enter a DSL which returns a list of objects (a single object would be converted into a singleton list) and extracts a property of each item using the Value property field. The resulting list of strings is then used for the selection.

In Declarative Pipeline Syntax, parameters can be specified as in the example below,

    parameters {
        ontrackChoiceParam(name: 'RELEASE_NUMBER', description: 'Release number', dsl: "ontrack.branch('PRJ', 'BRANCH').standardFilter(count: 5)", valueProperty: 'name')
    }

and then used as in the example below.

    params.RELEASE_NUMBER

Run condition

The Ontrack Jenkins plug-in provides a Run Condition which evaluates the result of the DSL into a boolean.

The DSL configuration is the same than above.

The result of the DSL execution is evaluated according to the following rules:

  • if a String different than '' (blank), evaluates to false
  • if a Boolean, uses its value
  • in any other case, evaluates to true

Environment setup

The Ontrack plugin provides an extension to the EnvInject plugin, allowing to run an Ontrack DSL in order to setup the build environment.

The DSL must return a map of <name, value> and this is injected into the build environment.

Following variables are bound to the script context:

  • ontrack - see the DSL section below
  • jenkins - see the DSL section below
  • build - the current AbstractBuild being configured
  • out - a PrintStream which can be used for logging
  • env - hudson.EnvVars instance which can be used to access current environment or build parameters.

The set of bound variables is different than the one used in other DSL actions.