ARTIFACTORY: How to tell if there are different artifacts in two separate repositories
There may be situations where you want to get the difference between two repositories, in other words if they have different artifacts in them.
For example, if you want to check if your federated repositories are working correctly, or if push replications are working correctly. You can use these aql queries and the "diff" BASH command to determine this as shown below:
curl -sSf -u <username>\
-H "content-type: text/plain" \
-X POST \
'<artifactoryurl>/artifactory/api/search/aql' \
-d 'items.find({"repo":"<repo1 name>"})' > repo1.txt
curl -sSf -u <username>\
-H "content-type: text/plain" \
-X POST \
'<artifactoryurl>/artifactory/api/search/aql' \
-d 'items.find({"repo":"<repo2 name>"})' > repo2.txt
#Diff the two and check for differences
diff repo1.txt repo2.txt
Be sure to replace all values in <> with your own custom values. You'll need to know:
- Your Username (Please ensure the user has access to the files in these repos)
- The 2 repo names
- The Artifactory URL
These commands should return a list of all artifacts, any differences between the two repositories will be shown by the "diff".