Search code examples
artifactory

How to delete a Artifactory build without artifacts?


We somehow managed to create a 'build' in Artifactory that does not have any artifacts (files) associated with it.

Through the web interface I only seem to be able to delete all builds for that particular release - which I obviously don't want.

Assuming we have 3 good 'builds' (has files etc.):

Moon -- 12.3 Build 23
Moon -- 12.4 Build 34
Moon -- 12.5 Build 89

and the aforementioned bad 'build'

Moon -- 12.0 Build 100

In the WebUI, 'Moon #12.0 Build 100' is listed in 'Last Deployed Builds' and also shows up as '12.0 Build 100' under 'Builds' for the 'Moon' release.

How do I delete the '12.0 Build 100' from Artifactory?

The WebUI seems to only allow deletion of all 'Moon' builds.

If the WebUI is a no go, how would I do so using the JFrog CLI or curl?

I am already having trouble coming up with the correct file spec to even find the 'build' - and obviously don't want to accidentally wipe out artifacts we want to keep.

{
    "files": [
        {
            "pattern": "/api/build/Moon"
        }
    ]
}

... doesn't return anything

{
    "files": [
        {
            "pattern": "my-repo/Moon/*"
        }
    ]
}

... returns all artifacts - but not the builds.

Thank you for any advice.


Solution

  • You can delete a specific build is using the delete builds REST API, for example

    curl -X DELETE http://myserver:8081/artifactory/api/build/my-build?buildNumbers=100
    

    In the upcoming version of Artifactory - 6.6, there will be a new option to delete a specific build from the UI (assuming you have the right permissions).