In Artifactory, an artifact may be overwritten as a result of the deployment of different artifacts bearing the same name and path. The two locations from which you can restore “lost” artifacts are the:
- Trash Can
To restore an artifact from the Trash Can, you must first verify that the Trash Can is enabled and that you haven't exceeded its configurable retention period (which, by default, is set to 14 days). If you're within this period, as shown below, you can restore your wayward file by finding it in the Trash Can, right-clicking on it, selecting Restore, and opting to Choose a Custom Path, which will guarantee that the restored file won’t overwrite an existing file. More information about the Trash Can is available HERE.
To restore a given artifact from the Filestore, in Artifactory version 7.x, navigate to $JFROG_HOME/artifactory/var/data/artifactory/filestore and select the directory within which that artifact is residing and do the following:
- Copy the artifact to a location outside of the Filestore
- Change its name from its current SHA-1 name to a new, desired name
- Upload the newly-named artifact back to a desired path in Artifactory
If you're working with Artifactory 6.x and below, if:
- your Trash Can hasn’t been enabled
- the Garbage Collection process hasn’t cleaned up your Filestore yet, and
- you have the checksum value (SHA-1) of your overwritten artifact
you should be able to locate it in and restore it from the Filestore, which is organized in a directory structure where each directory is named for the first two (2) characters of the checksum value of a given artifact. The screenshot below shows an example of the Filestore structure:
and within the "0f" directory, you can see the following artifact:
After you've found the overwritten artifact you're looking for:
- Copy it to a location outside of the Filestore.
- Change its name from its current SHA-1 name to a new, desired name.
- Upload the newly-named artifact back to a desired path in Artifactory.
More information about Artifactory’s Checksum-Based Storage can be found HERE.