Trigger Build Retention - Declarative Pipeline Syntax

JFrog Integrations Documentation

Content Type

Build retention can be triggered when publishing build-info to Artifactory using the rtPublishBuildInfo closure. Setting build retention therefore should be done before publishing the build, by using the rtBuildInfo closure, as shown below. Please make sure to place the following configuration in the script before the rtPublishBuildInfo closure.

rtBuildInfo (
    // Optional - Maximum builds to keep in Artifactory.
    maxBuilds: 1,
    // Optional - Maximum days to keep the builds in Artifactory.
    maxDays: 2,
    // Optional - List of build numbers to keep in Artifactory.
    doNotDiscardBuilds: ['3'],
    // Optional (the default is false) - Also delete the build artifacts when deleting a build.
    deleteBuildArtifacts: 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'