In general, we notice failed binary tasks when the artifact is marked for federation and fails to import the binary; such instances are classified as failed binary tasks. This could be due to non-existence of the binary in the file store or artifacts being deleted/removed before getting federated to another instance.
In order to identify and clean up these failed binaries tasks, we can run the below REST API’s from Artifactory version 7.68.11 and above.
- Retrieve a list of failed binary tasks via the REST API to obtain the count of binaries that have failed within a repository.
curl -u<user>:<password> -XGET "https://localhost:8082/artifactory/api/federation/binaries/failures/list?repoKey=<repo-name>" sample output [ { "sha1" : " b877a0f354bdbjkslqnbdbd82679404...", "repoKey" : "generic", "creationTime" : 1709902144846, "failuresCount" : 10 } ]
- Utilize the delete Failed Binary Tasks REST API to remove it.
curl -u<user>:<password> -XDELETE http://localhost:8082/artifactory/api/federation/binaries/failures/delete?repoKey=fedrepo sample output { "deletedTasks": 1 }
If you would like to delete any specific sha/binary run the below rest API:
curl -u<user>:<password> -XDELETE http://localhost:8082/artifactory/api/federation/binaries/failures/delete?repoKey=fedrepo&sha1=b877a0f354bdbjkslqnbdbd82679404…
This JIRA has been fixed. The patch is on version 7.98.10. We recommend to upgrade to that version and above to profit from automated binary_task deletion.
Note: Executing the Replay Failed Binary Tasks REST API can prove beneficial. In scenarios where binaries exist but have failed for various reasons, this API will reprocess those binary tasks that previously encountered failures.
You can also refer to this Article for further details on how to address the Binaries tasks table, which may accumulate stale entries, and execute cleanup operations at the database level.