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:
- From the Trash Can
- 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:
- Copy it outside the filestore
- Change its name from its current sha1 name to a new desired name.
- 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: