Get Dependencies and Artifacts from the Build-Info - Scripted Pipeline Syntax

JFrog Integrations Documentation

ft:sourceType
Paligo

The build-info instance stores the build-info locally. It can be later published to Artifactory. As shown above, the server.upload method adds artifacts to the build-info and the server.download method adds dependencies to the build-info.

You have the option of getting the list of dependencies and artifacts stored in the build-info instance. You can do this at any time, before or after the build-info is published to Artifactory. In the following example, ww first check if there are any dependencies stored in the build-info, and if there are, we access the properties of one of the dependencies. We then do the same for artifacts.

if (buildInfo.getDependencies().size() > 0) {
        def localPath = buildInfo.getDependencies()[0].getLocalPath()
        def remotePath = buildInfo.getDependencies()[0].getRemotePath()
        def md5 = buildInfo.getDependencies()[0].getMd5()
        def sha1 = buildInfo.getDependencies()[0].getSha1()
}

if (buildInfo.getArtifacts().size() > 0) {
        def localPath = buildInfo.getArtifacts()[0].getLocalPath()
        def remotePath = buildInfo.getArtifacts()[0].getRemotePath()
        def md5 = buildInfo.getArtifacts()[0].getMd5()
        def sha1 = buildInfo.getArtifacts()[0].getSha1()
}