successful.log file in working directory)xxx fields with your actual values (see Core Parameters section for details)Migrate all repositories under the team
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
Migrate specific project repositories
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_PROJECT="project1,project2" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -e PLUGIN_MIGRATE_TYPE="project" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
Migrate specific repositories
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_REPO="project1/repoA,project1/repoB,project2/repoC" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -e PLUGIN_MIGRATE_TYPE="repo" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_URL="https://github.com" \ -e PLUGIN_SOURCE_PLATFORM="github" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_URL="https://gitlab.com" \ -e PLUGIN_SOURCE_PLATFORM="gitlab" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_URL="https://gitee.com" \ -e PLUGIN_SOURCE_PLATFORM="gitee" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
docker run --rm \ -e PLUGIN_SOURCE_USERNAME="xxx" \ -e PLUGIN_SOURCE_PASSWORD="xxx" \ -e PLUGIN_SOURCE_PLATFORM="aliyun" \ -e PLUGIN_SOURCE_AK="xxx" \ -e PLUGIN_SOURCE_AS="xxx" \ -e PLUGIN_SOURCE_ORGANIZATIONID="xxx" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
HTTP Protocol
docker run --rm \ -e PLUGIN_SOURCE_USERNAME="xxx" \ -e PLUGIN_SOURCE_PASSWORD="xxx" \ -e PLUGIN_SOURCE_REPO="group1/repo1,group1/repo2,group2/repo3" \ -e PLUGIN_SOURCE_URL="https://common.example.com" \ -e PLUGIN_SOURCE_PLATFORM="common" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
SSH Protocol
⚠️ When using SSH protocol, ensure the private key file exists in current working directory with filename ssh.key
docker run --rm \ -e PLUGIN_SOURCE_REPO="group1/repo1,group1/repo2,group2/repo3" \ -e PLUGIN_SOURCE_URL="https://common.example.com" \ -e PLUGIN_SOURCE_PLATFORM="common" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -e PLUGIN_MIGRATE_SSH="true" \ -e GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_URL="https://git.woa.com" \ -e PLUGIN_SOURCE_PLATFORM="gongfeng" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
Migrate all repositories under specified root organization
docker run --rm \ -e PLUGIN_SOURCE_GROUP="xxx" \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_SOURCE_URL="https://cnb.example1.com" \ -e PLUGIN_SOURCE_PLATFORM="cnb" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -e PLUGIN_CNB_URL="https://cnb.example2.com" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
First run to generate repository list file repo-path.txt
Using CODING as an example (add -e PLUGIN_MIGRATE_ALLOW_SELECT_REPOS="true" \ parameter for other platforms):
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -e PLUGIN_MIGRATE_ALLOW_SELECT_REPOS="true" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
After first run, the tool will generate repo-path.txt in current directory. Please manually edit this file to keep only the repository paths you want to migrate.
After editing, run the same command again to migrate only selected repositories:
docker run --rm \ -e PLUGIN_SOURCE_TOKEN="xxx" \ -e PLUGIN_CNB_ROOT_ORGANIZATION="xxx" \ -e PLUGIN_CNB_TOKEN="xxx" \ -e PLUGIN_MIGRATE_ALLOW_SELECT_REPOS="true" \ -v $(pwd):$(pwd) -w $(pwd) \ cnbcool/code-import
To reselect repositories, simply delete repo-path.txt and run the command again.
Clear the successful.log file in the working directory
Effect: Re-sync all repositories from source platform. For repositories already migrated to CNB, if there are updates in source platform, the changes will be incrementally synced to CNB platform.
PLUGIN_SOURCE_URL
PLUGIN_SOURCE_TOKEN
PLUGIN_SOURCE_PLATFORM
PLUGIN_SOURCE_REPO
PLUGIN_SOURCE_USERNAME
PLUGIN_SOURCE_PASSWORD
PLUGIN_SOURCE_AK
PLUGIN_SOURCE_AS
PLUGIN_SOURCE_ENDPOINT
PLUGIN_SOURCE_ORGANIZATIONID
PLUGIN_CNB_URL
PLUGIN_CNB_TOKEN
PLUGIN_CNB_ROOT_ORGANIZATION
PLUGIN_SOURCE_GROUP
PLUGIN_MIGRATE_TYPE
PLUGIN_MIGRATE_CONCURRENCY
PLUGIN_MIGRATE_FORCE_PUSH
PLUGIN_MIGRATE_SKIP_EXISTS_REPO
PLUGIN_MIGRATE_USE_LFS_MIGRATE
PLUGIN_MIGRATE_ORGANIZATION_MAPPING_LEVEL
PLUGIN_MIGRATE_ALLOW_INCOMPLETE_PUSH
PLUGIN_MIGRATE_LOG_LEVEL
PLUGIN_MIGRATE_RELEASE
PLUGIN_MIGRATE_FILE_LIMIT_SIZE
PLUGIN_MIGRATE_CODE
PLUGIN_MIGRATE_SSH
PLUGIN_MIGRATE_REBASE
.cnb.yml file, use git rebase to ensure code synchronization, CNB pipeline configuration code will not be overwritten
⚠️ If enabled, force push will be enabled (PLUGIN_MIGRATE_FORCE_PUSH="true"), and CNB repository will be backed up in working directoryPLUGIN_SOURCE_PROJECT
PLUGIN_MIGRATE_ALLOW_SELECT_REPOS
Exceeding single file size limit of 500 MiB
Enable PLUGIN_MIGRATE_USE_LFS_MIGRATE parameter, see parameter description for details
Failed to get repository list: The current scope does not support access to this API Check if PLUGIN_SOURCE_TOKEN permissions meet requirements. For CODING platform, ensure token belongs to team owner or team admin.
LFS: Repository or object not found
Enable PLUGIN_MIGRATE_ALLOW_INCOMPLETE_PUSH, see parameter description for details
Push failed: git pull before pushing again
Enable PLUGIN_MIGRATE_FORCE_PUSH based on actual situation, see parameter description for details
How to migrate only specific repositories?
Set PLUGIN_MIGRATE_ALLOW_SELECT_REPOS=true, after first run edit repo-path.txt to keep only desired repository paths.
How to reselect repositories for migration?
Delete repo-path.txt file and run migration command again.
repo-path.txt not generated?
Ensure PLUGIN_MIGRATE_ALLOW_SELECT_REPOS=true and write permissions are available.