# Migrate from JFrog Artifactory

> Move your Artifactory repository files to CloudRepo, create matching repositories, repoint builds with a repository token, and cut over without a gap.

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.](#1-list-what-you-have)
2. [Create the repositories in CloudRepo.](#2-create-the-repositories)
3. [Export the files from Artifactory.](#3-export-the-files)
4. [Import them into CloudRepo.](#4-import-the-files)
5. [Repoint your builds.](#5-repoint-your-builds)
6. [Check, then cut over.](#6-check-then-cut-over)

## 1. List what you have

You need a CloudRepo organization. If you have none, [sign up](/docs/get-started/sign-up.html).

List your repositories from Artifactory, with their package types, using JFrog’s [repository list API](https://docs.jfrog.com/artifactory/reference/getrepositoriesbytypeandproject). 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**

```bash
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](https://docs.jfrog.com/artifactory/docs/repository-management) and [package types](https://docs.jfrog.com/artifactory/docs/supported-package-types):

| In Artifactory                                                    | In CloudRepo                                                                                                                                                                                                                                                                                                                       |
| ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Local repository, package type Maven, Gradle, npm, PyPI or Docker | A [repository](/docs/manage/repositories.html#creating-a-repository) of that format. Its files are what you export and import.                                                                                                                                                                                                     |
| Remote repository                                                 | A [proxy repository](/docs/consume/proxy-repositories.html), 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](https://docs.jfrog.com/artifactory/docs/virtual-repositories) as an aggregate of local and remote repositories, so you move those. Point builds at the CloudRepo repositories directly. For Maven and Docker, 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](https://docs.jfrog.com/artifactory/reference/getrepositoriesbytypeandproject)). They are not covered here. Email <support@cloudrepo.io> if you rely on them.

## 2. Create the repositories

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](/docs/manage/repositories.html#creating-a-repository). Then add whoever needs access: [add users](/docs/get-started/add-users.html), and create a [repository token](/docs/authenticate/repository-tokens.html) with **Read + write** for the import and **Read only** tokens for builds that only pull.

## 3. Export the files

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](https://docs.jfrog.com/administration/docs/access-tokens)).

`~/.jfrog.netrc`

```ini
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](https://docs.jfrog.com/artifactory/reference/getstorageitem) and download each one into a directory named for the repository:

**Terminal**

```bash
HOST=https://yourcompany.jfrog.io
REPO=libs-release-local
curl --netrc-file ~/.jfrog.netrc --silent --fail \
  "$HOST/artifactory/api/storage/$REPO/?list&deep=1&listFolders=0" | jq -r '.files[].uri' > "$REPO.txt"
while IFS= read -r p; do
  curl --netrc-file ~/.jfrog.netrc --silent --fail --create-dirs \
    --output "export/$REPO$p" "$HOST/artifactory/$REPO$p"
done < "$REPO.txt"
```

Expected: `export/<repository>/` holds every file, at the path it has in Artifactory. JFrog documents the [file list API](https://docs.jfrog.com/artifactory/reference/getstorageitem) as needing a non-anonymous privileged user and Artifactory Pro. JFrog’s own [JFrog CLI](https://docs.jfrog.com/artifactory/docs/generic-files) copies files down too (`jf rt download`), if you have it installed.

## 4. Import the files

[Import artifacts into CloudRepo](/docs/migrate/import-artifacts.html) 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](/docs/migrate/import-artifacts.html#running-a-loop-again).

## 5. Repoint your builds

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:

**Maven**

[Pull Maven artifacts](/docs/consume/maven.html) and [Publish Maven artifacts](/docs/publish/maven.html): `~/.m2/settings.xml` holds the credential, and `pom.xml` holds the repository URL.

**Gradle**

[Pull Gradle dependencies](/docs/consume/gradle.html) and [Publish Gradle artifacts](/docs/publish/gradle.html): `~/.gradle/gradle.properties` holds the credential, and your build script holds the repository URL.

**npm**

[Pull npm packages](/docs/consume/npm.html) and [Publish npm packages](/docs/publish/npm.html): `~/.npmrc` holds the registry and the token.

**pip**

[Pull Python packages](/docs/consume/python.html) and [Publish Python packages](/docs/publish/python.html): `pip.conf` or `PIP_INDEX_URL`, and `~/.pypirc` or `TWINE_*` for uploads.

**Docker**

[Pull Docker images](/docs/consume/docker.html) and [Push Docker images](/docs/publish/docker.html): `docker login` takes your CloudRepo host, and image names carry `/repositories/<repository>/`.

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.

## 6. Check, then cut over

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](/docs/authenticate/repository-tokens.html).
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](/docs/manage/webhooks.html).

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

---

The page: https://www.cloudrepo.io/docs/migrate/from-jfrog.html
