Update Release Bundle Cleanup Policy API

JFrog REST APIs

Content Type
REST API
ft:sourceType
Paligo

Description: This REST API is called to update configuration settings for an existing release bundle cleanup policy.

Note

A policy cannot be updated if it is currently running. If you want to update a policy that is running, you need to either wait for the policy to complete, or manually stop the run by calling Stop a Running Cleanup Policy API.

Security: Requires a platform admin. A project admin with permission can call this API on the project level.

Usage: PUT http://{host:port}/artifactory/api/cleanup/bundles/policies/{policyKey}

Produces: application/json

Sample Request:

{
  "key": "key1", //required
  "description": "",
  "cronExp": "0 0 2 * * ?",
  "itemType": "releaseBundle", //required
  "durationInMinutes": 60,
  "enabled": false,
  "searchCriteria": {
    "includeAllProjects": true,
    "includedProjects": [], //required
    "releaseBundles": [ 
      {
        "name": "**",
        "projectKey": ""
      }
    ], //required
    "excludePromotedEnvironments": [ 
      "**"
    ], //required
    "createdBeforeInMonths": 24 //required
  }
}

Parameter

Type

Required

Description

key

String

Yes

A unique identifier for the cleanup policy (for example, "key1"). This is a required field and must be unique.

Note

A minimum of three characters is required, including letters, numbers, underscore and hyphen.

description

String

No

A brief description of the cleanup policy (optional).

cronExp

String

Yes

A cron expression specifying when the cleanup job will run (for example, 0 0 2 * * ?).

Note

This parameter is not mandatory, however if left empty the policy will not run automatically and can only be triggered manually.

itemType

String

Yes

The type of items to clean up (releaseBundle). This field is required.

durationInMinutes

Integer

No

The maximum duration (in minutes) for policy execution, after which the policy will stop running even if not completed. While setting a maximum run duration for a policy is useful for adhering to a strict cleanup schedule, it can cause the policy to stop before completion (for example, 60).

enabled

Boolean

No

Indicates if the cleanup policy is active (true) or disabled (false).

A cleanup policy must be created inactive. This parameter is optional, but if used it must be set to false. If set to true when calling this API, the API call will fail and an error message is received.

Note

After a cleanup policy is created, it can be set to active by calling Enable/Disable Release Bundle Cleanup Policy API.

searchCriteria

Object

Yes

An object containing search criteria for the cleanup job.

includeAllProjects

Boolean

Yes

Specifies whether to include all projects in the search (true to include).

includedProjects

Array of Strings

Yes

A list of specific project keys to include in the search ().

releaseBundles

Array of Objects

Yes

An array specifying the release bundles to consider during cleanup.

name

String

Yes

The name of the release bundle. Set "**" to include all bundles.

projectKey

String

Yes

The project identifier associated with the release bundle. This key is obtained from the Project Settings screen. Leave the field blank to apply at a global level.

excludePromotedEnvironments

Array of Strings

Yes

A list of environments to exclude from the cleanup process. To exclude all, set to **.

createdBeforeInMonths

Integer

Yes

Specifies the time frame for filtering based on item creation date (for example, 24 months).

Sample Response: 

The contents of the response are identical to the Request.

Response Error Codes 

Code

Description

400

Validation errors.

404

A policy with the specified key does not exist.

500

Internal server error.