How to restore an overwritten Artifact

Daniel Poterman
2020-08-27 11:49

How to restore an overwritten Artifact

In the following Knowledge-Base article we will cover how to restore an Artifact the was overwritten in Artifactory. Such scenario can occur as a result of deploying different artifacts with same name and path.
There are two ways to do so: 

  1. From the Trash Can
  2. From the Filestore

We'll start with the first method: From the Trash Can.
In order to restore an Artifact from the Trash Can we must first verify that the Trash Can is enabled and that we did not exceed the Retention Period (which is set to 14 days by default).
If this is the case, we can simply restore the file from the Trash Can by Right Clicking on it >> Restore >> Choose a Custom Path so the restored file will not overwrite the existing file. 


More information about the Trash Can can be found here.

The second method: From the Filestore 
If the Trash Can is not enabled and Garbage Collection process didn't clean up the filestore yet, and you have the checksum value (sha1) of the overwritten artifact you can locate it under the filestore.
The filestore is organised in a directory structure where each directory name is the first 2 characters of the checksum value of the artifact.
See the below screenshot as an example of the filestore structure:
and within "0f" I have the following artifact:

Once you find the overwritten artifact:

  1. Copy it outside the filestore
  2. Change its name from its current sha1 name to a new desired name.
  3. Upload it back to Artifactory to a desired path.

More information about Artifactory Checksum-Based Storage can be found here.

The above mentioned Links are for Artifactory version 6.x.
This process is similar in Artifactory version 7.x and you can find the links to version 7.x documentation below:

  1. Trash Can Settings
  2. Garbage Collection
  3. Checksum-Based Storage