# README
Harness Migrator
harness-migrate is a command line utility to help convert and migrate continuous integration pipelines from other providers to Harness CI. You can use this tool to migrate repositories following guidlines below.
Please review known conversion and migration issues before using this tool.
Migrate Repositories
Migrating repositoires is a two-step process.
-
Export: Use
git-export
to export your repositories from your current provider. Guidlines for Bitbucket On-perm, GitHub, Gitlab; support for Bitbucket will be added. The exported data will be saved in a zip file. -
Import: Import the exported zip file into Harness using
git-import
to create new repositories as explained here.
Migrate Continuous Integration Pipelines
Install on Mac
Intel CPU
curl -L https://github.com/harness/harness-migrate/releases/latest/download/harness-migrate-darwin-amd64.tar.gz | tar zx
Apple silicon (M1 or M2) CPU
curl -L https://github.com/harness/harness-migrate/releases/latest/download/harness-migrate-darwin-arm64.tar.gz | tar zx
Copy the binary into place
sudo cp harness-migrate /usr/local/bin
Verify the install
harness-migrate --help
Build
$ git clone https://github.com/harness/harness-migrate.git
$ cd harness-migrate
$ go build
Usage
Drone
Convert a drone pipeline:
harness-migrate drone convert /path/to/.drone.yml
Export a github namespace from drone:
harness-migrate drone export \
--namespace example \
--github-token $GITHUB_TOKEN \
export.json
❗ To avoid pipelines triggering in both your Drone instance and in Harness CI, you must first deactivate the pipelines in your Drone instance.
This script uses jq and the Drone CLI to disable all pipelines defined in your export.json
:
#!/bin/bash
DRONE_NAMESPACE=$(jq -r .name export.json)
for REPO_NAME in $(jq -r .project[].name export.json); do
drone repo disable $DRONE_NAMESPACE/$REPO_NAME
done
Import a drone namespace:
harness-migrate drone import \
--harness-account $HARNESS_ACCOUNT \
--harness-org example \
--docker-connector account.harnessImage \
--github-token $GITHUB_TOKEN \
export.json
BitBucket
Convert a bitbucket pipeline:
harness-migrate bitbucket convert /path/to/bitbucket-pipelines.yml
CircleCI
Convert a circle pipeline:
harness-migrate circle convert /path/to/.circle/config.yml
GitHub Actions
Convert a github pipeline:
harness-migrate github convert /path/to/.github/workflows/main.yml
GitLab
Convert a gitlab pipeline:
harness-migrate gitlab convert /path/to/.gitlab-ci.yml
Terraform
Generate terraform configuration from an export, and apply it to your Harness account:
$ harness-migrate terraform \
--account $HARNESS_ACCOUNT \
--docker-connector account.harnessImage \
--org $HARNESS_ORG \
--repo-connector $HARNESS_REPO_CONNECTOR \
export.json \
output.tf
$ terraform init
$ terraform apply