|
1 | 1 | [](https://circleci.com/gh/devatherock/git-sync) |
2 | 2 | [](https://hub.docker.com/r/devatherock/vela-git-sync/) |
| 3 | +[](https://coveralls.io/github/devatherock/git-sync?branch=master) |
3 | 4 | [](https://hub.docker.com/r/devatherock/vela-git-sync/) |
4 | 5 | [](https://hub.docker.com/r/devatherock/vela-git-sync/) |
5 | 6 | [](https://microbadger.com/images/devatherock/vela-git-sync) |
6 | 7 | [](https://opensource.org/licenses/MIT) |
7 | 8 | # git-sync |
8 | 9 | CI plugin to sync the contents of a git repository with another |
9 | 10 |
|
10 | | -# Usage |
11 | | -## CircleCI |
12 | | -### On push |
| 11 | +## Usage |
| 12 | +### Docker |
13 | 13 |
|
14 | | -```yaml |
15 | | -version: 2 |
16 | | -jobs: |
17 | | - sync: |
18 | | - docker: |
19 | | - - image: devatherock/git-sync:latest |
20 | | - working_directory: ~/my-source-repo |
21 | | - environment: |
22 | | - PLUGIN_TARGET_REPO: "[email protected]:xyz/my-target-repo.git" # Git URI of target repository. If not specified, same as the source repo |
23 | | - PLUGIN_TARGET_BRANCH: master # Branch to sync to in target repository. Optional, defaults to master |
24 | | - PLUGIN_START_COMMIT: 29186cd # Commit sha of the first commit to sync. All commits after that will be synced. If not specified, commit sha of the penultimate tag will be used. And if no tags are present, all commits up to the 100th will be synced |
25 | | - PLUGIN_DEBUG: false # Flag to enable debug logs. Optional, by default, debug logs are disabled |
26 | | - GIT_SYNC_TOKEN: xyz # Github API token with push access to the repository. Required if HTTP URI of target repository is used |
27 | | - steps: |
28 | | - - checkout |
29 | | - - add_ssh_keys: |
30 | | - fingerprints: |
31 | | - - "ssh key fingerprint" # Fingerprint of SSH key with write access to target repository |
32 | | - - run: sh /scripts/entry-point.sh |
33 | | - |
34 | | -workflows: |
35 | | - version: 2 |
36 | | - git-sync: |
37 | | - jobs: |
38 | | - - sync: |
39 | | - filters: |
40 | | - branches: |
41 | | - only: master # Source branch |
| 14 | +```shell |
| 15 | +docker run --rm \ |
| 16 | + -e PLUGIN_DEBUG=true \ |
| 17 | + -e PLUGIN_START_COMMIT=29186cd \ |
| 18 | + -e PLUGIN_TARGET_BRANCH=test \ |
| 19 | + -v path/to/repo:/repo \ |
| 20 | + -w=/repo \ |
| 21 | + devatherock/drone-git-sync:latest |
42 | 22 | ``` |
43 | 23 |
|
44 | | -### On tag |
45 | | -Change `filters` section to below: |
| 24 | +### CI |
| 25 | +Please refer [docs](DOCS.md) |
46 | 26 |
|
47 | | -```yaml |
48 | | -tags: |
49 | | - only: /^v[0-9\.]+$/ # Regex to match tag pattern |
| 27 | +## Tests |
| 28 | +To test the latest plugin images, run the below command |
| 29 | +```shell |
| 30 | +sh functional-tests.sh |
50 | 31 | ``` |
51 | | - |
52 | | -Note: To add SSH key with write access to target repository, follow these |
53 | | -[instructions](https://circleci.com/docs/2.0/add-ssh-key/) |
54 | | - |
55 | | -## drone.io and vela |
56 | | -Please refer [docs](DOCS.md) |
0 commit comments