Standard Environment Variables
These environment variables are available to all executing pipelines.
Environment Variable | Description |
---|---|
|
Thename string of the pipeline currently executing. |
run_number |
The number of the run currently executing. |
|
Internal unique ID for the run. |
|
The |
|
Internal unique ID for the step currently executing. |
|
The |
|
Name of the Docker image used to run the step (e.g.pipelines-docker.jfrog.io/jfrog/pipelines-u16node). |
|
Tag of Docker image used to run the step. |
|
Name of the node used to run step (user-configured when adding node) |
|
Node architecture, e.g. x86_64 |
|
Internal unique ID for node |
step_node_pool_name |
Name of the node pool used to run the step (user configured when creating pool) |
project_name |
Name of the project |
project_id |
ID of the project in JFrog Pipelines |
project_key |
Project key. If the project is the default project, this will be empty. |
|
Direct link to step |
|
API URL |
|
onStart/onExecute/onComplete etc |
|
一步是运行的操作系统,e.g. Ubuntu_16.04 |
|
Same as |
|
Token used to call pipelines API during step execution. Used internally but is accessible to user. |
|
If triggered by a resource, the |
|
If triggered by another step, name of step. Else empty |
|
If triggered by a user, name of user. Else empty |
|
Affinity group step belongs to. Default is same as step name. |
|
True if step is running in a container. False if running on host. |
|
Set to "image" or "host" |
JFROG_CLI_BUILD_NAME |
If not set as a variable in the YML or added as a pipeline, run, or step variable, it will be set to $pipeline_name. This is used when accumulating build info. |
JFROG_CLI_BUILD_NUMBER |
If not set as a variable in the YML or added as a pipeline, run, or step variable, it will be set to $run_number. This is used when accumulating build info. |
JFROG_CLI_BUILD_PROJECT |
If not set as a variable in the YML or added as a pipeline, run, or step variable, it will be set to $project_key. This is used when accumulating or publishing build info. |
|
The value of PATH in the currently executing runtime environment. |
管道
A pipeline can declare environment variables in itsconfiguration
.The environment variables declared here are available to all steps in the pipeline.
pipelines: - name: my_pipeline configuration: environmentVariables: readOnly: env1: value1 env2: value2
Steps
A step can declare environment variables in itsconfiguration
of a step within a pipeline. The environment variables from this source are available only to the step where they are declared.
steps: - name: step_1 type: Bash configuration: environmentVariables: env1: value1 env2: value2
Environment Variables Configuration
Besides the key-value syntax, the following properties can also be used under an environment variable definition to enhance its configuration:
Property | Description | Required/Optional |
---|---|---|
default |
Default value for the environment variable. | Required |
description |
Describes the environment variable usage. This description is displayed in thecustom run configuration panel. | Optional |
values |
List of values that can be assigned to environment variables whencustom run configuration is used in the UI. | Optional |
allowCustom |
Determines) if users are allowed to use a custom value that is not part of the list ofvalues . Default value isfalse . |
Optional |
The followingproperties are available for environment variables declared in bothpipelinesandstepsconfiguration
sections.
pipelines: - name: my_pipeline configuration: environmentVariables: readOnly: env1: value1 env2: default: value1 description: env2 description values: - value1 - value2 - value3 steps: - name: my_step type: Bash configuration: environmentVariables: step_env1: default: value1 description: step env1 description values: - value1 - value2 - value3 allowCustom: true step_env2: value2
When youtrigger a run with custom configuration, the UI uses these configurations in the YAML file to control user input in the custom run configuration panel:
IfallowCustom
is set astrue
, you can enter any value for that fieldto define your own value for the run. In the example above, you can enter a custom value forstep_env2, in addition to the values that are already defined. Note that the custom value is available for a specific run only.
Integrations
A step that uses an integration can access an integration's properties through environment variables. The form of the environment variable is:
int_
For example, you can access the URL property of anArtifactory IntegrationnamedmyArtifactory
through an environment variable:
$ printenv int_myArtifactory_url https://mycompany.com/artifactory/
You can also access the properties of an integration through a resource that uses it. The form of the environment variable is:
res_
For example, anImageresource specifies an Artifactory integration in itsregistry
tag. You can access the URL of the Artifactory integration used by an Image resource calledmyImage
as follows:
$ printenv res_myImage_registry_url https://mycompany.com/artifactory/
For more information, see管道Integrations.
2022世界杯阿根廷预选赛赛程
A step that specifies a resource ininputresources
can access the properties of that resource through environment variables. The form of the environment variable is:
res_
For example, you can access theimageName
property of anImageresourcemyImage
through an environment variable:
$ printenv res_myImage_imageName jfrog.local:5000/alpine37
Some resources maintain additional properties that may be accessed as environment variables. These resource types include:
For further information see管道Resources.
Resource-based State
Additionally, you can add your own properties to a resource that is specified inoutputresources
using thewrite_output
utility function. This can be used to createstateful pipelines.
The newly attached properties can be accessed as environment variables of the formres_{Resource Name}_{Key Name}
.For example, the following creates three properties in the resourcemyImage
.
write_output myImage sport="baseball" equipment="bat" field="diamond"
When the resource is specified in a step'sinputsources
, these properties can be accessed as the following environment variables:
$ printenv res_myImage_baseball baseball $ printenv res_myImage_equipment bat $ printenv res_myImage_field diamond
For more information on run state, seeCreating Stateful Pipelines.
Run State
Your pipeline can define its own environment variables and add them to the pipeline's run state. These will be available to all steps in the run of the pipeline.
Use theutility functions for run state managementto add new environment variables to the current run state. For example, the following line in the execution block of a step:
add_run_variables hero="Superman" villain="Lex Luthor"
将创建两个环境变量可以吗the current and all future steps of the pipeline's run:
$ printenv hero Superman $ printenv villain Lex Luthor
For more information on run state, seeCreating Stateful Pipelines.
Pipeline State
Your pipeline can define its own environment variables and add them to the pipeline state. These will be available to all runs of that pipeline.
Use theutility functions for pipeline state managementto add new environment variables to the current run state. For example, the following line in the execution block of a step:
add_pipeline_variables animal="dog" vegetable="carrot"
将创建两个环境变量可以吗all run of the pipeline where they were defined:
$ printenv animal dog $ printenv vegetable carrot
For more information on pipeline state, seeCreating Stateful Pipelines.