Skip to main content
Version: Early Access

Mapping Task Output Properties to Variables

Learn how to capture task output properties in Digital.ai Release, map them to variables, and reuse those variables in subsequent tasks. This technique helps you pass values such as build numbers, artifact versions, or dynamic data across tasks within a release pipeline.


Prerequisites

  • Digital.ai Release
  • A release template with multiple tasks in a phase or pipeline
  • Familiarity with task configuration and variable usage in Release

Step 1: Identify the Task Output Properties

Most tasks in Digital.ai Release (script tasks, plugin tasks, etc.) expose Output properties.

Syntax:

${TaskName/Output/PropertyName}

For example:

${Jira: GetVersions/Output/Versions}
${Jenkins: Build/Output/Build number}
tip

You can confirm the exact output property names in the task configuration.

Here's the output properties for the Jenkins: Build task:

picture 0


Step 2: Create Variables to Map the Output Properties

Mapping the output property to a variable improves readability and reusability.

  1. Select Variables from the sidebar (at release, phase, or template level).
  2. Click New variable.
  3. Set:
    • Variable name: jenkinsBuildNumber
    • Label: Build number
    • Type Select the variable type, for example, Text
info

You can now use ${JenkinsBuildNumber} throughout the release pipeline. Clear the Required and Show on Create Release form check boxes if the variable is not user input. For more information, see Create Variables.

picture 1


Step 3: Map the Output Properties to Variables

Mapping a task's output property to a variable lets you reuse those variables in subsequent tasks. For example, you can map a Jenkins: Build task's Build number output property to a variable and use the variable in a subsequent script task.

Here's an example mapping:

picture 2


Step 4: Use the Variable in a Subsequent Task

Use the variables in a downstream task, for example, a Jython Script task. Here's an example.

print("The Jenkins Build Number is: " + str(releaseVariables['JenkinsBuildNumber']))
print("The Jenkins Build Job Status is: " + str(releaseVariables['jenkinsBuildStatus']))
print("The Jenkins Build Job URL is: " + str(releaseVariables['jenkinsBuildUrl']))

Troubleshooting Tips

ProblemPossible CauseSuggested Fix
Variable is empty or nullTask ran after variable was evaluatedEnsure task order is correct
Output property not foundTypo in task or property nameVerify names and case sensitivity
Variable doesn't updateDefined too early in the flowMove variable to a later phase

Example: Mapping Jenkins Build Output to Variables

The following example demonstrates how to capture output properties from a Jenkins build task, map them to variables, and use those variables in subsequent tasks within a Digital.ai Release pipeline. This step-by-step guide will help you implement the mapping process and verify the results.

Prerequisites

  • Ensure Digital.ai Release and Jenkins are installed and connected.

  • Create a Freestyle Jenkins build job named BuildApp that exports build details.

    Release-Jenkins Connection

Step 1: Create Output Variables

Create the following variables to capture the Jenkins build output:

  • JenkinsBuildNumber
  • jenkinsBuildStatus
  • jenkinsBuildUrl

Variables configuration

Step 2: Set up the Release Template

Create a release template (for example, map-output-to-var) with two tasks:

  1. Jenkins: Build

  2. Script: Jython Script

    Release template tasks

Step 3: Configure the Jenkins Build Task

Input Properties:

  • Select the Jenkins server from the drop-down list.

  • Enter the Jenkins job name (BuildApp).

    Jenkins server and job input

Output Properties:

  • Go to the Output Properties tab.

  • Map the BuildApp task's output properties to the three variables created earlier.

    Map output properties

Step 4: Configure the Jython Script Task

Add the following script to the Jython Script task named Print Jenkins Output Properties:

print("The Jenkins Build Number is: " + str(releaseVariables['JenkinsBuildNumber']))
print("The Jenkins Build Job Status is: " + str(releaseVariables['jenkinsBuildStatus']))
print("The Jenkins Build Job URL is: " + str(releaseVariables['jenkinsBuildUrl']))

Jython script configuration

Explanation:

  • Each print statement accesses a value from the releaseVariables dictionary, which contains variables mapped from Jenkins build output properties.
  • The value (such as JenkinsBuildNumber) is converted to a string using str() to ensure proper formatting.
  • The message and value are concatenated and printed, making it easy to display Jenkins build details in the Jython Script task log.

Step 5: Run and Verify the Release

  1. Create a new release from the template and run it.

  2. After successful completion, go to the Activity tab of the Jython Script task to view the Jenkins build output.

    View output in Activity tab