Control Build Retention

JFrog REST APIs

Content Type
REST API
ft:sourceType
Paligo

Description: Specifies retention parameters for build info

Since: 5.2.1

Note: A promoted Build Info cannot be deleted using this API. Starting from version 7.68.6, when executing the Build Retention command with the deleteBuildArtifacts parameter set to true, the build will be deleted but the build's Artifacts might not be deleted and remain in the repository.

Security: Requires a privileged user. From version 6.6, requires delete permission for the build.

Usage: POST /api/build/retention/{buildName}?async=<true | false>

The async flag controls how the endpoint responds to the client regarding build operations. It determines whether the client will receive an immediate response or wait until the operation is complete.

  • async=true

    • Returns a response immediately to the client.

    • The operation proceeds in the background.

  • async=false

    • Unless the configuration flag build.retention.always.async is set to true, the operation waits to complete before returning a response to the client.

Consumes: application/json

{ 
    "deleteBuildArtifacts" : <true | false>,    // When true, automatically removes build artifacts stored in Artifactory 
    "count" : <count>,                          // The maximum number of builds to store in Artifactory.
    "minimumBuildDate" : <date>,                // Earliest build date to store in Artifactory - ISO8601 (yyyy-MM-dd'T'HH:mm:ss.SSSZ)
    "buildNumbersNotToBeDiscarded" : [ ]        // List of build numbers that should not be removed from Artifactory
}

Sample Usage:

POST /api/build/retention/myBuild?async=true

{ 
    "deleteBuildArtifacts" : true, 
    "count" : 100, // 
    "minimumBuildDate" : 1407345768020, 
    "buildNumbersNotToBeDiscarded" : [ 5, 9] 
}