Get All Release Bundle v2 Cleanup Policies API

JFrog REST APIs

Content Type
REST API

Description: Returns a list of all existing Release Bundle v2 cleanup policies for either a specific project or for the entire system.

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

Usage: GET /artifactory/api/cleanup/bundles/policies/

Produces: application/json

Sample Request 

GET https://[JFrogPlatformURL]/artifactory/api/cleanup/bundles/policies/?projectKey=myProject

Query Parameters:

Field 

Type 

Description 

projectKey 

string

This parameter is used when calling this API to return all cleanup policies for a specific project. This parameter identifies the project of the policies you want to receive.

This parameter is optional for a platform admin, but not using it will return all cleanup policies in Artifactory, both global policies and project-level policies.

This parameter is mandatory for a project admin.

Sample Response: 

[
    {
        "key": "release_test_2",
        "description": "",
        "cronExp": "",
        "itemType": "releaseBundle",
        "durationInMinutes": 0,
        "enabled": false,
        "searchCriteria": {
            "includeAllProjects": true,
            "includedProjects": [],
            "releaseBundles": [
                {
                    "name": "**",
                    "projectKey": ""
                }
            ],
            "excludePromotedEnvironments": [
                "PROD"
            ],
            "createdBeforeInMonths": 25,
            "createdBeforeInDays": 730
        }
    },
    {
        "key": "release_test_3",
        "description": "",
        "cronExp": "",
        "itemType": "releaseBundle",
        "durationInMinutes": 0,
        "enabled": false,
        "searchCriteria": {
            "includeAllProjects": true,
            "includedProjects": [],
            "releaseBundles": [
                {
                    "name": "**",
                    "projectKey": ""
                }
            ],
            "excludePromotedEnvironments": [
                "PROD"
            ],
            "createdBeforeInMonths": 25,
            "createdBeforeInDays": 730
        }
    },
    {
        "key": "release_test_4",
        "description": "",
        "cronExp": "",
        "itemType": "releaseBundle",
        "durationInMinutes": 0,
        "enabled": false,
        "searchCriteria": {
            "includeAllProjects": false,
            "includedProjects": [
                "default"
            ],
            "releaseBundles": [
                {
                    "name": "**",
                    "projectKey": ""
                }
            ],
            "excludePromotedEnvironments": [
                "DEV"
            ],
            "createdBeforeInMonths": 25,
            "createdBeforeInDays": 730
        }
    },
    {
        "key": "release_test_1",
        "description": "",
        "cronExp": "",
        "itemType": "releaseBundle",
        "durationInMinutes": 0,
        "enabled": false,
        "searchCriteria": {
            "includeAllProjects": true,
            "includedProjects": [],
            "releaseBundles": [
                {
                    "name": "**",
                    "projectKey": ""
                }
            ],
            "excludePromotedEnvironments": [
                "DEV"
            ],
            "createdBeforeInMonths": 25,
            "createdBeforeInDays": 730
        }
    }
]

The response includes the following information:

Property

Type

Description

key

striing

The ID that identifies the policy. This ID was configured for the policy when it was created.

description

string

Description that was defined for the policy.

cronExp

string

The cron expression that determines when the policy is run.

itemType

string

The policy type (releaseBundle).

durationInMinutes

integer

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.

enabled

boolean

true value means the policy can be executed. A false value means that it cannot.

searchCriteria

array:objects

The criteria that define aspects of the policy such as package types (docker, maven), names of repositories in which the policy will run, and other relevant criteria.

searchCriteria.includeAllProjects

boolean

If true the policy is run on all Artifactory projects. The default value is false.

Note: This parameter is relevant only on the global level for Platform Admins.

searchCriteria.includedProjects

array;string

The name(s) of the project(s) on which the policy will run.

Note: This parameter is relevant only on the global level for Platform Admins.

searchCriteria.releaseBundles

array:object

The array of Release Bundles included in the cleanup.

searchCriteria.releaseBundles.name

array:string

The Release Bundle names. Set to ** to include all bundles.

searchCriteria.releaseBundles.projectKey

array:string

The project identifier associated with the Release Bundle, if any. This key is obtained from the Project Settings screen.

searchCriteria.excludePromotedEnvironments

array:string

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

searchCriteria.createdBeforeInMonths

integer

The time frame for filtering based on item creation dates in months.

For example, if this field is 2 then Release Bundles created more than 2 months ago will be deleted as part of the policy.

Note: This property is relevant for policies created before version 7.119.0.

searchCriteria.createdBeforeInDays

integer

The time frame for filtering based on item creation dates in days.

Note: This property is relevant for policies created after version 7.119.0.

Response Error Codes

Code

Description

400

Validation errors.

500

Internal server error.