Understanding context information in the CloudBees platform is key to a successful workflow.
Access contexts using an expression that references a context.
You can use the if
keyword for conditional expressions.
The following table lists the platform context objects and their scopes.
Context object name | Description |
---|---|
|
Information about the workflow run.
Refer to the |
|
Contains variables set in a workflow, job, or step for outputs.
Refer to the |
|
Contains information about steps run in the current job.
Refer to the |
|
Use the |
|
Contains outputs of jobs required for the current job to execute. |
|
Use the |
cloudbees
context
The cloudbees
context contains workflow run information.
Property name | Data type | Description |
---|---|---|
|
Object |
The top-level context. |
|
String |
The REST API name. |
|
String |
A token for authenticating to the CloudBees APIs. |
|
String |
The REST API URL. |
|
Object |
The webhook payload that triggers a workflow run.
|
|
String |
The name of the event that triggers a workflow run: |
|
String |
The home directory inside the current container; defaults to |
|
String |
The path to the registry mirror configuration file. |
|
Number |
Every run for a workflow in a component has a unique |
|
String |
Every workflow in a repository has a unique ID number, the |
|
Object |
The parent context for the SCM keys. |
|
String |
The name of the repository branch that contains the workflow file. |
|
String |
The SCM provider. Valid values are |
|
String |
The SCM provider host URL; for example, |
|
String |
The branch or tag ref that triggers a workflow run.
For example, a branch or tag ref that is pushed in a workflow with a |
|
String |
The repository path in the format |
|
String |
The URL of the SCM repository. |
|
String |
The commit SHA for the workflow file. |
|
String |
This value should normally be left to pick up the default value of ${{ cloudbees.scm.token }}, which injects the CloudBees workflow run token that uniquely identifies a job run within a workflow, and is used to authenticate that run against CloudBees services. |
|
String |
The default working directory for platform workflows. |
|
String |
This is a CloudBees-maintained version of a component. For workflow trigger events, the patch number is incremented. |
If you do not explicitly specify an SCM personal access token with the necessary permissions when invoking the Check out a Git repository action, the action uses the cloudbees.api.token input to make a call back to the CloudBees platform to request an SCM token (cloudbees.scm.token ) with the necessary permissions.
|
env
context usage
Use the env
context to define environment variables for containers that are specified in a step.
These variables can be used at three different scope levels:
-
Workflow
-
Job
-
Step
The values for the variables on the job and step levels can be set as strings or referenced from job outputs.
For example, the env
keyword is used for the context of a job:
env: VERSION: latest