How to validate the success of replication in JFrog Artifactory? [Video]

Angello Maggio
2021-02-02 14:55

In this video we’ll see how using the can help us find the difference in artifacts between two repositories in two separate Artifactory instances and allow us to download that difference to manually synchronize if necessary


Video Transcription

Hi everyone, my name is Angello Maggio, an Enterprise Solutions Lead here at JFrog. And today I will be showing you how to use the replicationDiff script to compare the contents of two repositories across two different Artifactory instances. This may be necessary because you suspect something might have gone wrong with your replication, or because you have paused replication for so long that you would like to find out what is the Delta between the two instances. There are many used cases that this can come in useful, and that is up to you. But today I will show you how our script can make your life easier to do this.

The script can be found under under artifactory-scripts, replicationDiff. It takes a few flags, such as the URLs for both Artifactory instances, the user that we’ll be using along with the password, the repository names on both sides, and it also takes in a flight that allows you to download the missing files so that you can later on manually synchronize the instances. For this test, I’ve created two simple repositories, very straightforward files. There’s three files in common between these repositories, two files that are missing, and two metadata files that are missing.

So let’s try the script and see how it helps us in this situation. The script is very straightforward. It allows us to give no flags and then it will ask us for the information that we need to pass. So first, we will give it the source Artifactory instance. Following rule, provide with the target Artifactory instance. The repository name, which I’ve called repo_one, and the target that we called repo_two, the admin user which I just use admin on both sides with their respective passwords.

Admin here as well. And that’s it. In a bigger instance, it might take a little bit longer time, but in general, it’s a very fast script. In this case, it has told me that I’m missing four files, one JSON, one XML, and two TXT files. And then it asks me if it wants to download the files to synchronize later, why not? Now we can see that it has cured a couple of files for us. First, we have filepaths_uri, which will show us the URLs or the URIs for all of the missing files that were fine. Then we have filepaths_nometadatafiles of TXT. As the name mentioned, it’s the same results as before excluding the metadata files, since metadata files may not need to be uploaded as Artifactory can regenerate these files for you. And lastly, because we have decided to download the files, it created a replication downloads directory as well.

And here we can find that it also created two files, five TXT and three TXT, which are the ones that are missing on the target instance. We can also run the same script, by passing the flags directly. So let’s remove… or we felt that we have a fresh start and we can run that same command. But this time we’re passing all of the information that before prompted us as flights. So for instance, we have the source Artifactories, the passwords. And wherever we want to download the files, why not? We click, we sent, and now you can see, we have the same contents that we had before. So these can be used as an automation, as a health check, once in a while, run it, and he can report to you which files are missing. That would be all for today. I hope that this was a useful video for you to get this stream and best of luck, until the next time.