Skip to content

Migrate from JFrog Artifactory

cloudrepo-migrate artifactory moves the files of your Artifactory local Maven repositories into CloudRepo, then reads every file back from CloudRepo and checks it against the original. Artifactory is only read.

Used on this page only, never saved. Never enter a token or password here.

Install it from pypi.org. It needs Python 3.8 or later, and artifactory needs version 0.5.0 or later: if cloudrepo-migrate --version shows an older one, run pipx upgrade cloudrepo-migrate.

Terminal
pipx install cloudrepo-migrate

Before you run it, list your repositories to find the key of each Maven one, create a repository of the same format in CloudRepo for each, with the same name if you can, and create a repository token with Download and publish packages on them. Then put the credentials in the environment of the shell that runs the tool: ARTIFACTORY_ACCESS_TOKEN, an Artifactory access token that can read the repositories, and CLOUDREPO_TOKEN, the CloudRepo repository token. No option takes a credential.

Run it first with --dry-run, which lists what would move and uploads nothing. Name each Maven repository with --repo, so the run moves those and nothing else. With CLOUDREPO_TOKEN set, a dry run also checks the token and that each target repository exists:

Terminal
cloudrepo-migrate artifactory \
--artifactory-url https://yourcompany.jfrog.io/artifactory \
--org your-org \
--repo libs-release-local \
--repo libs-snapshot-local \
--dry-run

When the list is right, run the same command without --dry-run, and with --report-json to keep the report:

Terminal
cloudrepo-migrate artifactory \
--artifactory-url https://yourcompany.jfrog.io/artifactory \
--org your-org \
--repo libs-release-local \
--repo libs-snapshot-local \
--report-json report.json

The last line says how many files were verified. Exit code 0 means everything moved and verified. On 1, each failed file is listed with its path: run the same command again to resume.

The command does step 3 and step 4 for those repositories, and checks every file it moves. Step 2 and step 5 are still yours, then check and cut over. Its options, and what it skips, are in Migrate from Artifactory to CloudRepo.

This page moves the files in your Artifactory repositories to CloudRepo and repoints your builds, with JFrog left running until your builds pass against CloudRepo. It copies files and nothing else: your users, permissions and every other piece of data that is not a file stay in Artifactory.

  1. List what you have and decide where each repository goes.
  2. Create the repositories in CloudRepo.
  3. Export the files from Artifactory.
  4. Import them into CloudRepo.
  5. Repoint your builds.
  6. Check, then cut over.

You need a CloudRepo organization. No account yet? Start free trial. 14 days free. No credit card required.

List your repositories from Artifactory, with their package types, using JFrog’s repository list API. JFrog documents it as needing admin privileges, or a scoped token with artifact:*:r or system:info:r. Give curl the credential through the netrc file described in step 3.

Terminal
curl --netrc-file ~/.jfrog.netrc --silent --fail \
"https://yourcompany.jfrog.io/artifactory/api/repositories?type=local" | jq -r '.[] | [.key, .packageType] | @tsv'

Then decide where each one goes. The left column uses JFrog’s names for its repository types and package types:

In Artifactory In CloudRepo
Local repository, package type Maven, Gradle, npm, Python or Docker A repository of that format. Its files are what you export and import.
Remote repository A proxy repository, if the upstream is one CloudRepo offers. Nothing to export: a proxy fills itself from the upstream.
Virtual repository No copy. JFrog describes a virtual repository as an aggregate of local and remote repositories, so you move those. Point builds at the CloudRepo repositories directly. For Maven, Docker, Python and npm (Python and npm in early access), a group repository can serve several repositories under one address.
Any other package type, or a Generic repository No CloudRepo repository for it. CloudRepo hosts Maven, Python, npm and Docker, and cannot create a raw (generic) repository.

JFrog’s repository list API also names federated and distribution repositories (JFrog). They are not covered here. Email support@cloudrepo.io if you rely on them.

Every other Artifactory and Nexus term, and what CloudRepo calls it, is on Artifactory and Nexus terms in CloudRepo, which also says where CloudRepo has no equivalent.

For each local repository, create a repository of the same format in CloudRepo, and give it the name your builds already use if you can, so a URL changes in one place only. See Creating a repository. Then add whoever needs access: add users, and create a repository token with Download and publish packages for the import and Download packages tokens for builds that only pull.

Give your Artifactory credential to curl through a netrc file, so it is on no command line. JFrog documents that a reference token can be used instead of a password for basic authentication, as long as the username is the one the token was created with (Access Tokens).

~/.jfrog.netrc
machine yourcompany.jfrog.io
login jfrog-user
password JFROG_REFERENCE_TOKEN

Keep the file readable by you alone (chmod 600 ~/.jfrog.netrc). Then, for each repository, list its files with Artifactory’s file list API and download each one into a directory named for the repository:

Terminal
HOST=https://yourcompany.jfrog.io
REPO=libs-release-local
(
curl --netrc-file ~/.jfrog.netrc --silent --show-error --fail \
"$HOST/artifactory/api/storage/$REPO/?list&deep=1&listFolders=0" > "$REPO.json" \
|| { echo "FAILED: could not list $REPO" >&2; exit 1; }
jq -r '.files[].uri' "$REPO.json" > "$REPO.txt" \
|| { echo "FAILED: could not read the list of $REPO" >&2; exit 1; }
: > "$REPO.failed.txt"
failed=0
while IFS= read -r p; do
curl --netrc-file ~/.jfrog.netrc --silent --show-error --fail --create-dirs \
--output "export/$REPO$p" "$HOST/artifactory/$REPO$p" \
|| { echo "FAILED: $p" >&2; echo "$p" >> "$REPO.failed.txt"; rm -f "export/$REPO$p"; failed=$((failed + 1)); }
done < "$REPO.txt"
total=$(wc -l < "$REPO.txt" | tr -d ' ')
if [ "$failed" -gt 0 ]; then
echo "$failed of $total files could not be fetched; their paths are in $REPO.failed.txt" >&2
exit 1
fi
echo "Exported $total files from $REPO"
)

Expected: export/<repository>/ holds every file, at the path it has in Artifactory. The loop prints each file it could not fetch, writes those paths to <repository>.failed.txt, and exits with a non-zero status if any failed or if the list could not be read. JFrog documents the file list API as needing a non-anonymous privileged user and Artifactory Pro. JFrog’s own JFrog CLI copies files down too (jf rt download), if you have it installed.

Import artifacts into CloudRepo has one loop for each format. Run it for each repository, then check the bytes arrived. You can run a loop again after a failure, and what a second run skips and what it replaces depends on the format: see Running a loop again.

In each build, replace the Artifactory URL and credential with the CloudRepo repository’s URL and a repository token. The page for your build tool shows the file to change:

Pull Maven artifacts and Publish Maven artifacts: ~/.m2/settings.xml holds the credential, and pom.xml holds the repository URL.

The username for every client except npm is the email address of the account that created the token, and the password is the token. In CI, store the token in the CI system’s secret store and expose it as an environment variable, as the pages above show; do not write it into a script or a committed file.

A lockfile holds URLs too. Change every Nexus and Artifactory URL in your builds, lockfiles included maps each Artifactory URL to its CloudRepo URL, finds every one in your repositories and regenerates package-lock.json, yarn.lock, poetry.lock and uv.lock.

A script can call Artifactory too. If one calls the Artifactory REST API to fetch the latest version of an artifact or to upload a file, REST calls in your scripts after Nexus or Artifactory shows the call to run against CloudRepo in its place, and the calls that have none.

If a CI job publishes through the JFrog CLI, an Artifactory build plugin or the Nexus staging plugin, Move your CI off the JFrog CLI and Nexus staging shows the plain command that replaces each.

If Dependabot or Renovate keeps your dependencies current, repoint it too: Dependabot and Renovate with CloudRepo shows the registry block for each, for Maven, npm, Python and Docker.

Do this in order, and leave Artifactory running until the last step:

  1. Build against CloudRepo, with Artifactory still up. Point one project at CloudRepo and run its full build, then the projects that depend on it. A 401, 403 or 404 has the same causes as when you publish by hand: see “When a Client Answers 401, 403 or 404” on Repository tokens.
  2. Publish one new version to CloudRepo from CI and install it from a second machine.
  3. Switch every build that still names Artifactory, and every CI job’s secret, to CloudRepo.
  4. Stop publishing to Artifactory. From now on a new version exists in CloudRepo only.
  5. Keep an export of Artifactory until you are sure nothing reads it. Step 3 of this page is that export.

Webhooks, if you used any, are not copied. CloudRepo’s are in Webhooks, and Move Artifactory and Nexus webhooks to CloudRepo maps each Artifactory event and payload field to them.

If you are stuck, email support@cloudrepo.io with your organization name, the repositories involved, the command you ran and the error it printed.

View as Markdown