Publish Build-Info to Artifactory - Scripted Pipeline Syntax

JFrog Integrations Documentation

Content Type

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

Files that are downloaded by the are automatically registered as the current build's dependencies, while files that are uploaded by the server.upload are registered as the build artifacts. The dependencies and artifacts are recorded locally(Ex: Jenkins environment) using the respective buildinfo objects and can be later published as build-info to Artifactory. See the examples below:

def buildInfo1 = downloadSpec    // The method downloads the artifacts from Artifactory using download spec and adds them as dependencies to the build-info object created in the build client.
def buildInfo2 = server.upload uploadSpec        // The server.upload method adds artifacts to the build-info object created in the build client. 
buildInfo1.append buildInfo2                     // Appending the buildInfo2 object content to buildInfo1 object.
server.publishBuildInfo buildInfo1               // Publishing the buildInfo1 object to Artifactory server.
def buildInfo = Artifactory.newBuildInfo() spec: downloadSpec, buildInfo: buildInfo
server.upload spec: uploadSpec, buildInfo: buildInfo
server.publishBuildInfo buildInfo 

You also have the option of customising the build-info module names, used for the download and upload operations. Here's how you do it:

def buildInfo1 = spec: downloadSpec, module: 'my-custom-build-info-module-name'
def buildInfo2 = server.upload spec: uploadSpec, module: 'my-custom-build-info-module-name'