Publish Build-Info to Artifactory - Declarative Pipeline Syntax

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo

If you're not yet familiar with the build-info entity, read about it here.

Files that are downloaded by the rtDownload closure are automatically registered as the current build's dependencies, while files that are uploaded by the rtUpload closure are registered as the build artifacrts. The depedencies and artifacts are recorded locally and can be later published as build-info to Artifactory.

Here's how you publish the build-info to Artifactory:

rtPublishBuildInfo (
    serverId: 'Artifactory-1',
    // The buildName and buildNumber below are optional. If you do not set them, the Jenkins job name is used 
    // as the build name. The same goes for the build number.
    // If you choose to set custom build name and build number by adding the following buildName and 
    // buildNumber properties, you should make sure that previous build steps (for example rtDownload 
    // and rtIpload) have the same buildName and buildNumber set. If they don't, then these steps will not
    // be included in the build-info.
    buildName: 'holyFrog',
    buildNumber: '42',
    // Optional - Only if this build is associated with a project in Artifactory, set the project key as follows.
    project: 'my-project-key'
)

If you set a custom build name and number as shown above, please make sure to set the same build name and number in the rtUpload or rtDownload closures as shown below. If you don't, Artifactory will not be able to associate these files with the build and therefore their files will not be displayed in Artifactory.

rtDownload (
    serverId: 'Artifactory-1',
    // Build name and build number for the build-info:
    buildName: 'holyFrog',
    buildNumber: '42',
    // Optional - Only if this build is associated with a project in Artifactory, set the project key as follows.
    project: 'my-project-key',
    // You also have the option of customising the build-info module name:
    module: 'my-custom-build-info-module-name',
    specPath: 'path/to/spec/relative/to/workspace/spec.json'
)

rtUpload (
    serverId: 'Artifactory-1',
    // Build name and build number for the build-info:
    buildName: 'holyFrog',
    buildNumber: '42',
    // Optional - Only if this build is associated with a project in Artifactory, set the project key as follows.
    project: 'my-project-key',
    // You also have the option of customising the build-info module name:
    module: 'my-custom-build-info-module-name',
    specPath: 'path/to/spec/relative/to/workspace/spec.json'
)