How do I delete old release builds? (“Max release builds”)

JFrog Support
2023-01-22 11:10

There are two categories to consider when we talk about deleting artifacts: Handling artifacts that have already been deployed, and handling future deployments.

Handling the artifacts already deployed to Artifactory:

You can delete old builds by build number from the UI at artifacts tab ? tree browser, right click on a repository’s name, or browse deeper to the folder from which you want to delete recursively, and choose ‘delete versions’, this will open a menu with all relevant build versions to delete, mark the ones you want to delete.

您还可以删除的版本构建REST API with the‘Delete build’query.

Handling future builds:

In order to utilize a mechanism that deletes older releases as the ‘max unique snapshots’ does for snapshot versions, you could write your own‘user plugin’which would do the following:

  • Intercept artifact-deployments to Artifactory with the‘afterCreate’hook
  • Check if the deployment artifacts are from the relevant build (check thebuild.nameand build.number properties)
  • Run the cleanup accordingly.