Sign inSign up

osshelp/drone-git-mirror

By osshelp

•Updated about 4 years ago

Drone CI plugin for mirroring to external git repositories

Image
1

10K+

osshelp/drone-git-mirror repository overview

⁠Description

The plugin is used for mirroring Git repositories to external ones and it has 2 modes:

  1. full mirroring (default)
  2. partial mirroring

Details on both of them are described below.

⁠Usage example

⁠Full mirroring

By default, this plugin will perform full mirroring. Please note, that the clone step should be disabled.

trigger:
  event: [push, tag]

clone:
  disable: true

steps:
  - name: mirror
    image: osshelp/drone-git-mirror
    settings:
      target_repo: [email protected]:OSSHelp/some-repo.git
      ssh_key:
        from_secret: git-mirror-private-key

This mode works similar to --mirror option for git-push. Technical details you can find here⁠.

⁠Partial mirroring

If the file named mirror_ignore_list exists, then the plugin will perform partial mirroring.

steps:
  - name: mirror
    image: osshelp/drone-git-mirror
    settings:
      target_repo: [email protected]:OSSHelp/some-repo.git
      ssh_key:
        from_secret: git-mirror-private-key

The content of mirror_ignore_list file should be compatible with --exclude-from option from rsync flag (GNU tar way).

⁠Params

ParamDefaultDescription
target_repo-SSH clone URL of target repo
ssh_key-Private key with R/W permissions to use for interacting with target_repo.
git_emaildrone@osshelpE-mail that will be used while pushing changes
git_nameDrone CIName that will be used while pushing changes
ignore_errorsfalseIf set to true the plugin will try to ignore all occurring errors to prevent build failing because of itself.
mirror_ignore_list.mirror_ignoreIf this file is found in repo root - it contents will be used as excludement list for mirroring

⁠FAQ

⁠How to exclude unwanted files from sync

You need to create a file, named .mirror_ignore (if not overwritten with mirror_ignore_list variable) in the root directory of your repository. Describe wanted and unwanted files and directories inside as if you are preparing a file for using with --exclude-from option from rsync (GNU tar way).

For example:

.drone.yml
.mirror_ignore
file1.txt
dir1/*
dir2
⁠How to delete excluded files or branches from remote repo

Files, excluded with mirror_ignore_list will not be automatically removed from the remote repository. Neither do branches. No plans of implementing such functionality. Hence, you should do it manually.

⁠Sources

Source repository is available at Github here⁠.

⁠License

GPL3

⁠Author

OSSHelp Team, see https://oss.help⁠

Tag summary

Content type

Image

Digest

sha256:e8b00cad1…

Size

11.8 MB

Last updated

about 4 years ago

docker pull osshelp/drone-git-mirror