logo
0
0
WeChat Login
Forkfromcnb/plugins/cnbcool/artifact-migrate, behindmain22 commits

CNB Artifact Migration Tool

Features

  1. Supports migrating maven and npm artifacts from Coding, Nexus, Jfrog, and Codeup platforms to CNB

Using with Docker

Notes

  1. ⚠️ Ensure the CNB artifact repository exists before migration
  2. Nexus, Jfrog mainly support local repositories
  3. For Nexus repositories with over 10,000 versions, please configure a migration list (otherwise only 10,000 versions will be migrated)
  4. Codeup currently doesn't support migrating plugin-generated metadata files

Migrating from Coding/Nexus/Jfrog to CNB

1. Mounting Configuration Files

  1. Mount log directory: -v $(pwd):/app/log
  2. Log files include execution logs, successfully migrated packages, and failed migrations
  3. For incremental migration: Mount successfully migrated package files and configure path in config.yaml's excludePackageVersion
docker run --rm \
  -u root \
  -v /data/conf/config.yaml:/app/config.yaml \
  # Mount migration list when needed (configured in config.yaml's includePackageVersion)
  -v /data/conf/config-maven-includePackageName.txt:/app/config-maven-includePackageName.txt \
  # Mount exclusion list when needed (configured in config.yaml's excludePackageVersion) 
  -v /data/conf/config-maven-excludePackageName.txt:/app/config-maven-excludePackageName.txt \
  # Log directory
  -v $(pwd):/app/log \
  docker.cnb.cool/cnb/plugins/cnbcool/artifact-migrate:latest

2. Parameter Mode (ARTIFACT_MIGRATE:parameter-mode)

Parameters:

  1. SRC_INCLUDE_PACKAGE: Packages to migrate (format: package or package:version)
  2. SRC_EXCLUDE_PACKAGE: Packages to exclude (format: package or package:version)
  3. ARTIFACT_TYPE: maven or npm
  4. SRC_REGISTRY_TYPE: jfrog, nexus, coding or codeup
  5. SRC_REGISTRY_TOKEN: API token for Codeup
docker run --rm \
    -u root
    -e ARTIFACT_MIGRATE="parameter-mode" \
    -e ARTIFACT_TYPE="maven" \
    -e SRC_REGISTRY_TYPE="coding" \
    -e SRC_INCLUDE_PACKAGE="org.xxx:1.0.0|org.test" \
    -e SRC_EXCLUDE_PACKAGE="" \
    -e SRC_REGISTRY_URL="http://example.com" \
    -e SRC_REGISTRY_USERNAME="user" \
    -e SRC_REGISTRY_PASSWORD="pass" \
    -e TAR_REGISTRY_URL="http://cnb.cool/repo" \
    -e TAR_REGISTRY_PASSWORD="cnbpass" \
    -v $(pwd):/app/log \
    docker.cnb.cool/cnb/plugins/cnbcool/artifact-migrate:latest

Using with CNB

Notes

  1. ⚠️ Ensure CNB artifact repository exists first
  2. Place config.yaml in project root directory
  3. Default CNB pipeline path: /workspace
main:
  push:
    - stages:
        - name: Artifact Migration
          image: docker.cnb.cool/cnb/plugins/cnbcool/artifact-migrate:latest

config.yaml Parameters

artifactory:
  maven:
    - src:
        type: coding # jfrog/nexus/coding/codeup
        includePackageVersion: # Packages to include (regex or file)
        excludePackageVersion: # Packages to exclude  
        url: http://example.com/repo
        username: user
        password: pass
        token: # For Codeup only
      target:
        url: http://cnb.cool/target
        password: cnbpass
        
  npm:
    - src:
        type: coding
        includePackageVersion: ^coding # Regex example
        excludePackageVersion: /app/exclude.txt # File example
        url: http://example.com/npm
        username: npm-user
        password: npm-pass
      target:
        url: http://cnb.cool/npm
        password: cnbpass

Package List Format (txt)

org.xxx:1.0.0
org.test

About

No description, topics, or website provided.
Language
Go99.5%
Dockerfile0.5%
Shell0.1%