Aggregate Builds - Declarative Pipeline Syntax

JFrog Integrations Documentation

ft:sourceType
Paligo

The build-info published to Artifactory can include multiple modules representing different build steps. As shown earlier in this section, you just need to pass the same buildName and buildNumber to all the steps that need it (rtUpload for example).

What happens however if your build process runs on multiple machines or it is spread across different time periods? How do you aggregate all the build steps into one build-info?

When your build process runs on multiple machines or it is spread across different time periods, you have the option of creating and publishing a separate build-info for each segment of the build process, and then aggregating all those published builds into one build-info. The end result is one build-info which references other, previously published build-infos.

In the following example, our pipeline script publishes two build-info instances to Artifactory:

rtPublishBuildInfo (
    serverId: 'Artifactory-1',
    buildName: 'my-app-linux',
    buildNumber: '1'
)

rtPublishBuildInfo (
    serverId: 'Artifactory-1',
    buildName: 'my-app-windows',
    buildNumber: '1'
)

At this point, we have two build-infos stored in Artifactory. Now let's create our final build-info, which references the previous two:

rtBuildAppend(
    // Mandatory:
    serverId: 'Artifactory-1',
    appendBuildName: 'my-app-linux',
    appendBuildNumber: '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: 'final',
    buildNumber: '1'
)
 
rtBuildAppend(
    // Mandatory:
    serverId: 'Artifactory-1',
    appendBuildName: 'my-app-windows',
    appendBuildNumber: '1',
    buildName: 'final',
    buildNumber: '1'
)

// Publish the aggregated build-info to Artifactory. 
rtPublishBuildInfo (
    serverId: 'Artifactory-1',
    buildName: 'final',
    buildNumber: '1'
)

If the published builds in Artifactory are associated with a project, you should add the project key to the rtBuildAppend and rtPublishBuildInfo steps as follows.

rtBuildAppend(
    // Mandatory:
    serverId: 'Artifactory-1',
    appendBuildName: 'my-app-linux',
    appendBuildNumber: '1',
    buildName: 'final',
    buildNumber: '1',
    project: 'my-project-key'
)
 
rtBuildAppend(
    // Mandatory:
    serverId: 'Artifactory-1',
    appendBuildName: 'my-app-windows',
    appendBuildNumber: '1',
    buildName: 'final',
    buildNumber: '1',
    project: 'my-project-key'
)

// Publish the aggregated build-info to Artifactory. 
rtPublishBuildInfo (
    serverId: 'Artifactory-1',
    buildName: 'final',
    buildNumber: '1',
    project: 'my-project-key'
)

Note

Build Promotion and Build scanning with Xray are currently not supporting aggregated builds.