Capture Environment Variables - Declarative Pipeline Syntax

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo

To set the Build-Info object to automatically capture environment variables while downloading and uploading files, add the following to your script.

Note

It is important to place the rtBuildInfo closure before any steps associated with this build (for example, rtDownload and rtUpload), so that its configured functionality (for example, environment variables collection) will be invoked as part of these steps.

rtBuildInfo (
    captureEnv: true,

    // Optional - Build name and build number. If not set, the Jenkins job's build name and build number are used.
    buildName: 'my-build',
    buildNumber: '20',
    // Optional - Only if this build is associated with a project in Artifactory, set the project key as follows.
    project: 'my-project-key'
)

By default, environment variables names which include "password", "psw", "secret", "token", or "key" (case insensitive) are excluded and will not be published to Artifactory.

You can add more include/exclude patterns with wildcards as follows:

rtBuildInfo (
    captureEnv: true,
    includeEnvPatterns: ['*abc*', '*bcd*'],
    excludeEnvPatterns: ['*private*', 'internal-*'],

    // Optional - Build name and build number. If not set, the Jenkins job's build name and build number are used.
    buildName: 'my-build',
    buildNumber: '20'
    // Optional - Only if this build is associated with a project in Artifactory, set the project key as follows.
    project: 'my-project-key'
)