You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DOCS.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,4 +40,28 @@ steps:
40
40
secrets: [ git_sync_token ]
41
41
parameters:
42
42
target_branch: prod
43
+
```
44
+
45
+
### CircleCI
46
+
To add SSH key with write access to target repository, follow these [instructions](https://circleci.com/docs/2.0/add-ssh-key/)
47
+
48
+
```yaml
49
+
version: 2
50
+
jobs:
51
+
sync:
52
+
docker:
53
+
- image: devatherock/git-sync:latest
54
+
working_directory: ~/my-source-repo
55
+
environment:
56
+
PLUGIN_TARGET_REPO: "[email protected]:xyz/my-target-repo.git"# Git URI of target repository. If not specified, same as the source repo
57
+
PLUGIN_TARGET_BRANCH: master # Branch to sync to in target repository. Optional, defaults to master
58
+
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
59
+
PLUGIN_DEBUG: false # Flag to enable debug logs. Optional, by default, debug logs are disabled
60
+
GIT_SYNC_TOKEN: xyz # Github API token with push access to the repository. Required if HTTP URI of target repository is used
61
+
steps:
62
+
- checkout
63
+
- add_ssh_keys:
64
+
fingerprints:
65
+
- "ssh key fingerprint"# Fingerprint of SSH key with write access to target repository
Copy file name to clipboardExpand all lines: README.md
+16-42Lines changed: 16 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,50 +7,24 @@
7
7
# git-sync
8
8
CI plugin to sync the contents of a git repository with another
9
9
10
-
# Usage
11
-
## CircleCI
12
-
### On push
10
+
## Usage
11
+
### Docker
13
12
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
13
+
```shell
14
+
docker run --rm \
15
+
-e PLUGIN_DEBUG=true \
16
+
-e PLUGIN_START_COMMIT=29186cd \
17
+
-e PLUGIN_TARGET_BRANCH=test \
18
+
-v path/to/repo:/repo \
19
+
-w=/repo \
20
+
devatherock/drone-git-sync:latest
42
21
```
43
22
44
-
### On tag
45
-
Change `filters` section to below:
23
+
### CI
24
+
Please refer [docs](DOCS.md)
46
25
47
-
```yaml
48
-
tags:
49
-
only: /^v[0-9\.]+$/ # Regex to match tag pattern
26
+
## Tests
27
+
To test the latest plugin images, run the below command
28
+
```shell
29
+
sh functional-tests.sh
50
30
```
51
-
52
-
Note: To add SSH key with write access to target repository, follow these
0 commit comments