Skip to content

Latest commit

 

History

History
138 lines (117 loc) · 8.5 KB

README.md

File metadata and controls

138 lines (117 loc) · 8.5 KB

drone-image-migration

Synopsis

This plugin is designed to migrate a Docker image from one registry to another.

To learn how to utilize Drone plugins in Harness CI, please consult the provided documentation.

Parameters

Parameter Choices/Defaults Comments
source
string
required
The source image to be copied
username
string
required
Username to login to the destination registry
password
string
PAT / access token to authenticate with the destination registry
destination
string
required
The destination where image will be copied
source_username
string
Username to login to the source registry
source_password
string
PAT / access token to authenticate with the source registry
aws_access_key_id
string
AWS access key ID for generating access token
aws_secret_access_key
string
AWS secret access key for generating access token
aws_region
string
AWS region containing the ECR registry
source_aws_access_key_id
string
Source AWS access key ID for generating access token
source_aws_secret_access_key
string
Source AWS secret access key for generating access token
source_aws_region
string
Source AWS region containing the ECR registry
overwrite
boolean
Default: false Overwrite the existing image at destination, if present
insecure
boolean
Default: false Disable TLS

Notes

While using AWS ECR as destination registy, set username as AWS, and either provide the AWS access token as password, or provide the aws_access_key_id, aws_secret_access_key and aws_region.

While migrating from one AWS ECR to another AWS ECR (separate accounts), set username and source_username as AWS, and either provide the AWS access tokens as password and source_password, or provide the source_aws_access_key_id, source_aws_secret_access_key and source_aws_region separately.

While using Google Artifact Registry, use oauth2accesstoken as the relevant username and access-token as the password.

Plugin Image

The plugin plugins/image-migration is available for the following architectures:

OS Tag
latest linux-amd64/arm64, windows
linux/amd64 linux-amd64
linux/arm64 linux-arm64
windows windows-amd64

Examples

# Plugin YAML
- step:
    type: Plugin
    name: Migration Plugin
    identifier: Migration_Plugin
    spec:
        connectorRef: my-docker-connector
        image: plugins/image-migration
        settings:
                source: footloose/gitness:1.2.3
                destination: tremors/gitness:1.2.3
                username: kevinbacon
                password: <+secrets.getValue("docker_pat")>

- step:
    type: Plugin
    name: Migration Plugin
    identifier: Migration_Plugin
    spec:
        connectorRef: my-docker-connector
        image: plugins/image-migration
        settings:
                source: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/gitness-dev:1.2.3
                destination: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/gitness-prod:1.2.3
                username: AWS
                aws_access_key_id: "012345678901"
                aws_secret_access_key: <+secrets.getValue("aws_secret_access_key")>
                aws_region: us-west-2

- step:
    type: Plugin
    name: Migration Plugin
    identifier: Migration_Plugin
    spec:
        connectorRef: my-docker-connector
        image: plugins/image-migration
        settings:
                source: aws_account_id.dkr.ecr.us-west-2.amazonaws.com/gitness-dev:1.2.3
                destination: aws_account_id_2.dkr.ecr.us-west-2.amazonaws.com/gitness-prod:1.2.3
                username: AWS
                aws_access_key_id: "012345678901"
                aws_secret_access_key: <+secrets.getValue("aws_secret_access_key")>
                aws_region: us-west-2
                source_username: AWS
                source_aws_access_key_id: "190219201220"
                source_aws_secret_access_key: <+secrets.getValue("source_aws_secret_access_key")>
                aws_region: us-west-2

- step:
    type: Plugin
    name: Migration Plugin
    identifier: Migration_Plugin
    spec:
        connectorRef: my-docker-connector
        image: plugins/image-migration
        settings:
                source: registry-1.example.com/gitness:1.2.3
                destination: registry-2.example.com/gitness:1.2.3
                source_username: finncarter
                source_password: <+secrets.getValue("source_docker_pat")>
                username: kevinbacon
                password: <+secrets.getValue("docker_pat")>
                overwrite: true

- step:
    type: Plugin
    name: Migration Plugin
    identifier: Migration_Plugin
    spec:
        connectorRef: my-docker-connector
        image: plugins/image-migration
        settings:
                source: registry-1.example.com/gitness:1.2.3
                destination: LOCATION-docker.pkg.dev/PROJECT-ID/REPO-NAME/IMAGE-NAME
                source_username: finncarter
                source_password: <+secrets.getValue("source_docker_pat")>
                username: oauth2accesstoken
                password: <+secrets.getValue("gcr_pat")>
                overwrite: true

ℹ️ If you notice any issues in this documentation, you can edit this document to improve it.