ARTIFACTORY: How to check if config migration was successful
Note: This article is for the purpose of checking if a config transfer was successful. If you would like guidance on the steps to complete the configuration transfer please use the documentation here.
During the configuration transfer phase of a cloud migration you will receive a message from the JFrog CLI telling you that the configuration transfer was a success. However, you may want a more in depth way of checking that all your repositories, users, groups and permissions have migrated successfully.
During the configuration transfer phase the repos will be migrated, but the artifacts themselves won't. Don't worry if the repos on your SaaS instance are empty, that’s the expected state during this step. The artifacts will be migrated during the file transfer phase.
The simplest way to check is to try and login into your SaaS instance via the UI. You should be able to login into your SaaS instance using the credentials from your self hosted instance. If you are able to do this, it is a good indication that your migration succeeded.
Another simple way to check via the UI is to navigate to the repositories tab of your SaaS instance. You should see the number of repositories in the instance listed there as show in the screenshot below:
The number of repositories here should match the number in your self hosted instance.
Programmatic Verification of the Transfer
You may also wish for a more in depth programmatic way to check if the configuration transfer succeeded. With the Artifactory REST API, there are a series of curl commands you can use to check this.
The general idea is to download a list of names from both the On-Prem and the SaaS, sort them, then compare the sorted lists. You need to do the sort in order for the "diff" to work properly. If you get large diff results, double check that the sort completed successfully.
Note: Anything in <> must be replaced with your own artifactory url or credentials.
Repository Check
1. Get two lists of repository keys, one for on-prem and one for SaaS
# Self Hosted Artifactory Repositories List curl -u <username> <jfrogurlSelfHosted>/artifactory/api/repositories | grep "key" > on-prem-artifactory.json # Cloud Artifactory Repositories List curl -u <username>:<password> <jfrogurlSaaS>/artifactory/api/repositories | grep "key" > cloud-artifactory.json
2. Sort the outputs, these two commands will make separate "sorted" JSON files:
sort on-prem-artifactory.json > on-prem-artifactory-sorted.json sort cloud-artifactory.json > cloud-artifactory-sorted.json
3. "diff" the two sorted files
diff on-prem-artifactory-sorted.json cloud-artifactory-sorted.json
If the diff command returns no results, it means the repositories are exactly the same for both SaaS and Self Hosted.
Username Check
1. Download the username list from both On-Prem and SaaS
# On-Prem Artifactory Username List curl -u <username> <jfrogurlSelfHosted>/artifactory/api/security/users | grep "name" > on-prem-users.json # Cloud Artifactory Username List curl -u <username> <jfrogurlSaaS>/artifactory/api/security/users | grep "name" > cloud-users.json
2. Sort the two lists
sort on-prem-users.json > on-prem-users-sorted.json sort cloud-users.json > cloud-users-sorted.json
3. "diff" the two files
diff on-prem-users-sorted.json cloud-users-sorted.json
If the diff command returns no results, it means the username lists are exactly the same for both SaaS and Self Hosted.
Groups Check
1. Get the group list from both on-prem and SaaS
# On-Prem Artifactory Groups List curl -u <username> <jfrogurlSelfHosted>/artifactory/api/security/groups | grep "name" > on-prem-groups.json # Cloud Artifactory Group List curl -u <username>:<password> <jfrogurlSaaS>/artifactory/api/security/groups | grep "name" > cloud-groups.json
2. Sort the two lists:
sort on-prem-groups.json > on-prem-groups-sorted.json sort cloud-groups.json > cloud-groups-sorted.json
3. "diff" the two lists:
diff on-prem-groups-sorted.json cloud-groups-sorted.json
If the diff command returns no results, it means the group lists are exactly the same for both SaaS and Self Hosted.
Permissions Check
1. Get the group list from both on-prem and SaaS
# On-Prem Artifactory Permissions List curl -u <username> <jfrogurlSelfHosted>/artifactory/api/security/permissions | grep "name" > on-prem-perms.json # Cloud Artifactory Group List curl -u <username>:<password> <jfrogurlSaaS>/api/security/permissions | grep "name" > cloud-perms.json
2. Sort the two lists:
sort on-prem-perms.json > on-prem-groups-perms.json sort cloud-perms.json > cloud-groups-perms.json
3] "diff" the two lists:
diff on-prem-groups-perms.json cloud-groups-perms.json
If the diff returns nothing then the permissions between your SaaS and Self Hosted are the same. There may be some minor differences in the Environment permissions.