harness-migrate

command module
v0.45.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

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 repositories is a two-step process.

  1. Export: Use git-export to export repositories with metadata from your current SCM provider. Guidlines for Bitbucket On-perm, GitHub, Gitlab, and Bitbucket. The exported data will be saved in a zip file.

    [OPTIONAL] Use the update-users command to map user emails in the exported data to their corresponding Harness emails. See documentation for details. Without this step, unmatched emails will default to the migrator user.

  2. Import: Import the exported data into Harness CODE using git-import command as explained here.

Using Docker

The migrator is available as a Docker image with all required dependencies pre-installed. Follow these steps:

  1. Build and run the container:
docker build -t harness-migrate .
docker volume create migrator-data
docker run -it --name harness-migrate -v migrator-data:/data harness-migrate
  1. Inside the container, run your export/import commands:
# Export example
harness-migrate [SCM-Provider] git-export [flags]

# Import example
harness-migrate git-import [flags]

Note: All data is stored in the Docker volume migrator-data which persists even if you stop or remove the container. To clean up after you're done:

docker rm migrator
docker volume rm migrator-data

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
internal
harness
Package harness provides a Harness http client.
Package harness provides a Harness http client.
migrate/bitbucket
Package bitbucket provides automatic migration tools from Bitbucket Cloud to Harness.
Package bitbucket provides automatic migration tools from Bitbucket Cloud to Harness.
migrate/circle
Package circle provides automatic migration tools from Circle to Harness.
Package circle provides automatic migration tools from Circle to Harness.
migrate/circle/client
Package client provides a Circle http client.
Package client provides a Circle http client.
migrate/drone
Package drone provides automatic migration tools from Drone to Harness.
Package drone provides automatic migration tools from Drone to Harness.
migrate/github
Package github provides automatic migration tools from Github to Harness.
Package github provides automatic migration tools from Github to Harness.
migrate/gitlab
Package gitlab provides automatic migration tools from GitLab to Harness.
Package gitlab provides automatic migration tools from GitLab to Harness.
migrate/travis
Package travis provides automatic migration tools from Travis to Harness.
Package travis provides automatic migration tools from Travis to Harness.
slug
Package slug provides utilities for working with slug values.
Package slug provides utilities for working with slug values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL