Skip to content

Commit c127d25

Browse files
authored
Merge pull request #21 from devatherock/20-one-image
chore: Stopped publishing drone-git-sync and vela-git-sync images
2 parents 6a6adc2 + 2936b5d commit c127d25

File tree

5 files changed

+86
-97
lines changed

5 files changed

+86
-97
lines changed

.circleci/config.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,9 @@ jobs:
7272
at: ~/git-sync
7373
- run: |
7474
TAG=${CIRCLE_SHA1:0:8}
75-
docker build -t devatherock/drone-git-sync:$TAG -f docker/Dockerfile .
76-
docker tag devatherock/drone-git-sync:$TAG devatherock/drone-git-sync:latest
77-
docker tag devatherock/drone-git-sync:$TAG devatherock/vela-git-sync:$TAG
78-
docker tag devatherock/drone-git-sync:$TAG devatherock/vela-git-sync:latest
79-
docker tag devatherock/drone-git-sync:$TAG devatherock/git-sync:$TAG
80-
docker tag devatherock/drone-git-sync:$TAG devatherock/git-sync:latest
75+
docker build -t devatherock/git-sync:$TAG -f docker/Dockerfile .
76+
docker tag devatherock/git-sync:$TAG devatherock/git-sync:latest
8177
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
82-
docker push devatherock/drone-git-sync:$TAG
83-
docker push devatherock/drone-git-sync:latest
84-
docker push devatherock/vela-git-sync:$TAG
85-
docker push devatherock/vela-git-sync:latest
8678
docker push devatherock/git-sync:$TAG
8779
docker push devatherock/git-sync:latest
8880
@@ -99,6 +91,8 @@ jobs:
9991
- v1-dependencies-
10092
- run: |
10193
sh functional-tests.sh
94+
- store_test_results:
95+
path: build/test-results
10296
- save_cache:
10397
paths:
10498
- ~/.gradle
@@ -115,12 +109,8 @@ jobs:
115109
TAG=${CIRCLE_TAG#v}
116110
DEV_TAG=${CIRCLE_SHA1:0:8}
117111
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
118-
docker pull devatherock/drone-git-sync:$DEV_TAG
119-
docker tag devatherock/drone-git-sync:$DEV_TAG devatherock/drone-git-sync:$TAG
120-
docker tag devatherock/drone-git-sync:$TAG devatherock/vela-git-sync:$TAG
121-
docker tag devatherock/drone-git-sync:$TAG devatherock/git-sync:$TAG
122-
docker push devatherock/drone-git-sync:$TAG
123-
docker push devatherock/vela-git-sync:$TAG
112+
docker pull devatherock/git-sync:$DEV_TAG
113+
docker tag devatherock/git-sync:$DEV_TAG devatherock/git-sync:$TAG
124114
docker push devatherock/git-sync:$TAG
125115
126116
notify:

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
### Changed
88
- fix: Fixed a few Codacy code violations
99

10+
### Removed
11+
- [#7](https://github.com/devatherock/git-sync/issues/20): Publishing of `drone-git-sync` and `vela-git-sync` images
12+
1013
## [1.1.0] - 2021-01-27
1114
### Changed
1215
- test([#9](https://github.com/devatherock/git-sync/issues/9)): Added unit tests

DOCS.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

README.md

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
[![CircleCI](https://circleci.com/gh/devatherock/git-sync.svg?style=svg)](https://circleci.com/gh/devatherock/git-sync)
2-
[![Version](https://img.shields.io/docker/v/devatherock/vela-git-sync?sort=semver)](https://hub.docker.com/r/devatherock/vela-git-sync/)
2+
[![Version](https://img.shields.io/docker/v/devatherock/git-sync?sort=semver)](https://hub.docker.com/r/devatherock/git-sync/)
33
[![Coverage Status](https://coveralls.io/repos/github/devatherock/git-sync/badge.svg?branch=master)](https://coveralls.io/github/devatherock/git-sync?branch=master)
44
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/c09d2da01eba4895b7d4709880e5c548)](https://www.codacy.com/gh/devatherock/git-sync/dashboard?utm_source=github.com&utm_medium=referral&utm_content=devatherock/git-sync&utm_campaign=Badge_Grade)
5-
[![Docker Pulls](https://img.shields.io/docker/pulls/devatherock/vela-git-sync.svg)](https://hub.docker.com/r/devatherock/vela-git-sync/)
6-
[![Docker Image Size](https://img.shields.io/docker/image-size/devatherock/vela-git-sync.svg?sort=date)](https://hub.docker.com/r/devatherock/vela-git-sync/)
7-
[![Docker Image Layers](https://img.shields.io/microbadger/layers/devatherock/vela-git-sync.svg)](https://microbadger.com/images/devatherock/vela-git-sync)
5+
[![Docker Pulls](https://img.shields.io/docker/pulls/devatherock/vela-git-sync.svg)](https://hub.docker.com/r/devatherock/git-sync/)
6+
[![Docker Image Size](https://img.shields.io/docker/image-size/devatherock/git-sync.svg?sort=date)](https://hub.docker.com/r/devatherock/git-sync/)
87
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
98
# git-sync
109
CI plugin to sync the contents of a git repository with another
@@ -19,14 +18,80 @@ docker run --rm \
1918
-e PLUGIN_TARGET_BRANCH=test \
2019
-v path/to/repo:/repo \
2120
-w=/repo \
22-
devatherock/drone-git-sync:latest
21+
devatherock/git-sync:1.1.0
2322
```
2423

2524
### CI
26-
Please refer [docs](DOCS.md)
25+
#### Config
26+
The following parameters/secrets can be set to configure the plugin.
27+
28+
**Parameters**
29+
* **target_repo** - Git URI of target repository. If not specified, same as the source repo
30+
* **target_branch** - Branch to sync to, in target repository. Optional, defaults to master
31+
* **start_commit** - Commit sha of the first commit to sync. All commits after that will be synced. If not specified,
32+
commit sha of the penultimate tag will be used. And if no tags are present, all commits up to the 100th will be synced
33+
* **debug** - Flag to enable debug logs. Optional, by default, debug logs are disabled
34+
35+
**Secrets**
36+
37+
The following secret values can be set to configure the plugin.
38+
39+
* **GIT_SYNC_TOKEN** - Github API token with push access to the repository. Required if HTTP URI of target repository
40+
is used
41+
42+
#### drone.io
43+
44+
```yaml
45+
git-sync:
46+
when:
47+
ref: refs/tags/v*
48+
event: tag
49+
image: devatherock/git-sync:1.1.0
50+
target_branch: prod
51+
secrets: [ git_sync_token ]
52+
```
53+
54+
#### vela
55+
56+
```yaml
57+
steps:
58+
- name: git-sync
59+
ruleset:
60+
tag: refs/tags/v*
61+
event: tag
62+
image: devatherock/git-sync:1.1.0
63+
secrets: [ git_sync_token ]
64+
parameters:
65+
target_branch: prod
66+
```
67+
68+
#### CircleCI
69+
To add SSH key with write access to target repository, follow these [instructions](https://circleci.com/docs/2.0/add-ssh-key/)
70+
71+
```yaml
72+
version: 2
73+
jobs:
74+
sync:
75+
docker:
76+
- image: devatherock/git-sync:1.1.0
77+
working_directory: ~/my-source-repo
78+
environment:
79+
PLUGIN_TARGET_REPO: "[email protected]:xyz/my-target-repo.git" # Git URI of target repository. If not specified, same as the source repo
80+
PLUGIN_TARGET_BRANCH: master # Branch to sync to in target repository. Optional, defaults to master
81+
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
82+
PLUGIN_DEBUG: false # Flag to enable debug logs. Optional, by default, debug logs are disabled
83+
GIT_SYNC_TOKEN: xyz # Github API token with push access to the repository. Required if HTTP URI of target repository is used
84+
steps:
85+
- checkout
86+
- add_ssh_keys:
87+
fingerprints:
88+
- "ssh key fingerprint" # Fingerprint of SSH key with write access to target repository
89+
- run: sh /scripts/entry-point.sh
90+
```
91+
2792
2893
## Tests
29-
To test the latest plugin images, run the below command
94+
To test the latest plugin image, run the below command
3095
```shell
3196
sh functional-tests.sh
3297
```

src/test/groovy/io/github/devatherock/gitsync/docker/SyncGitReposDockerSpec.groovy

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,31 @@ class SyncGitReposDockerSpec extends Specification {
1212
@Shared
1313
def config = [
1414
'drone' : [
15-
'image' : 'devatherock/drone-git-sync:latest',
1615
'envPrefix' : 'PLUGIN_',
1716
'emailVar' : 'DRONE_COMMIT_AUTHOR_EMAIL',
1817
'usernameVar': 'DRONE_COMMIT_AUTHOR'
1918
],
2019
'vela' : [
21-
'image' : 'devatherock/vela-git-sync:latest',
2220
'envPrefix' : 'PARAMETER_',
2321
'emailVar' : 'BUILD_AUTHOR_EMAIL',
2422
'usernameVar': 'BUILD_AUTHOR'
2523
],
2624
'circleci': [
27-
'image' : 'devatherock/git-sync:latest',
2825
'envPrefix' : 'PLUGIN_',
2926
'emailVar' : 'CIRCLE_USERNAME',
3027
'usernameVar': 'CIRCLE_USERNAME'
3128
]
3229
]
3330

31+
@Shared
32+
String dockerImage = 'devatherock/git-sync:latest'
33+
3434
String currentBranch = System.getenv('CURRENT_BRANCH')
3535
String testBranch = 'func-test'
3636

3737
void setupSpec() {
3838
System.setProperty('java.util.logging.SimpleFormatter.format', '%5$s%n')
39-
ProcessUtil.executeCommand("docker pull ${config['drone'].image}")
40-
ProcessUtil.executeCommand("docker pull ${config['vela'].image}")
41-
ProcessUtil.executeCommand("docker pull ${config['circleci'].image}")
39+
ProcessUtil.executeCommand("docker pull ${dockerImage}")
4240
}
4341

4442
void setup() {
@@ -68,7 +66,7 @@ class SyncGitReposDockerSpec extends Specification {
6866
'-e', "GIT_SYNC_TOKEN=${System.getenv('GIT_TOKEN')}",
6967
'-e', "${config[ci].emailVar}[email protected]",
7068
'-e', "${config[ci].usernameVar}=devatherock",
71-
config[ci].image])
69+
dockerImage])
7270

7371
then:
7472
output[0] == 0

0 commit comments

Comments
 (0)