ARTIFACTORY: How to replicate a specific folder or a list of folders from a repository using Push Replication
In this exposition, we shall elucidate the process of replicating a designated folder from the source Artifactory to the destination Artifactory through the utilization of Push Replication. Additionally, we will explore the incorporation of exclusion patterns.
This particular scenario becomes relevant when administrators seek to limit the availability of specific folders from a source repository on the destination server. The objective is to ensure that only designated users are able to access packages contained within the specified folder.
In order to proceed with setting up the use case, we need to make sure we have the below requirements satisfied.
- Two Artifactory instances:- Artifactory-one and Artifactory-two with unique licenses
- A local repository each on the source and destination server.
Now, we can use the below steps in order to set up the replication.
- In the Artifactory-one local repository, deploy some packages at the folder level(make sure we have multiple folders inside this repository). Here, we have two folders namely jar-folder1 and json-folder1 in the repository.
2. Now Navigate to the repository settings(Administration -> Repositories -> select the repository and click on the Replications tab).
3. Under the replications tab, enable active Replication of this repository(based on the requirement) and click on Add Replication.
4. Enter the URL of the destination instance, username, and password, and Test the connection.
5. After the connection is successful, we can use the include/exclude patterns mentioned at last of the replication tab(above Test connection).
Here, we are only replicating the jar- folder1 to the destination, hence we used jar-folder/* in the include patterns field and click on ‘+’ then save it.
6. After saving the configuration, enter the CRON expression based on your requirement(here we are using 0 0 12 * * ? that is at 12 noon everyday). Now save the Repository settings.
7.Once the settings are saved, either wait for the replication to occur based on the CRON job or manually run the replication by clicking on Replication icon present for the repository.
8. Now, you will see that only the folder that was a part of include pattern has been replicated from source to destination. Below is the screenshot of repository from destination server.
In the above way, we can also add multiple include/exclude patterns and achieve the desired use case based on the requirement.
Additionally, for more information on Push Replication and Include/exclude patterns you may refer to the below documentation.