The Solution

ARTIFACTORY: What to do when you want to resolve a Directory Location but also Files within the Directory in Artifactory Remote Repositories

AuthorFullName__c
Derek Pang
articleNumber
000005640
ft:sourceType
Salesforce
FirstPublishedDate
2023-03-21T10:55:20Z
lastModifiedDate
2023-03-21
VersionNumber
2
There will be three sections needed to accomplish this use case.
  1. A remote repository that resolves the actual artifacts.
  2. A remote repository that resolves the folders and does not resolve the actual artifacts.
  3. A virtual repository to funnel requests to the above two remote repositories.

To set up 1. we will create another remote repository in the same location. However, with this repository, we will need to add an include rule so that this repository will only resolve the actual artifacts.
The default includes patterns (**/*) allowing for the resolution of anything. For my particular use case, I am only interested in storing the actual artifacts so I will refine the included pattern so that this repository will only resolve items with extensions that I am interested in (**/*.zip, **/*.sig).

User-added image



To set up 2. we will use the same “hashicorp-folders-remote” remote repository but will adjust the configurations.
We will add an exclude pattern for files with extensions so that those requests will go to the other remote repository.

User-added image

We will also disable the “Store Artifacts Locally” setting in this repository in order for requests to be able to go into a folder within a folder. This setting will cause items not to be cached in Artifactory for this repository which will prevent the 400 error in the case of a Folder within a Folder scenario.

User-added image


Finally for 3. we will create a virtual repository containing these two remote repositories in order to have one location to resolve the items from.
User-added image