Skip to content
This repository was archived by the owner on Nov 10, 2019. It is now read-only.

Commit 1aa9025

Browse files
Merge pull request #46 from codefresh-io/gitclonerssh
Gitclonerssh
2 parents a3aea99 + aa87108 commit 1aa9025

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

plugins/gitclonerssh/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Clone repository via SSH
2+
Plugin to clone git repositories via SSH.
3+
4+
Dockerhub repo: https://hub.docker.com/r/codefresh/cfstep-gitclonerssh
5+
6+
## Options
7+
| ENVIRONMENT VARIABLE | DEFAULT | TYPE | REQUIRED | DESCRIPTION |
8+
|--|--|--|--|--|
9+
| REMOTE_URL | null | string | Yes | Reporitory SSH URL (e.g. `git@github.com:my-user/my-repo.git`) |
10+
| BRANCH | master | string | No | Branch name to checkout (e.g. `master`) |
11+
| SSH_KEY | null | string | Yes | Private SSH key to access the repository. To convert it to single line string, and set a value for this var you can execute: `cat ~/.ssh/my_ssh_key_file | tr '\n' ','`. This assumes that `SPLIT_CHAR` will be set to `,` |
12+
| SPLIT_CHAR | null | string | Yes | Split character you’ve used to replace newline in SSH key (`SSH_KEY`). Recommendation: use `,` (comma character)|
13+
| CLONE_PATH | working directory | string | No | Path where `git clone` is going to be executed. A "`repo-name`" directory will be created there|
14+
15+
## Usage Example:
16+
This example clones a private repo using a private SSH key.
17+
This example assumes that `SSH_KEY` var is already saved as an encrypted-pipeline-var. And that `SPLIT_CHAR` has a value of ','.
18+
19+
```yaml
20+
version: '1.0'
21+
steps:
22+
clone_repo_via_ssh:
23+
image: codefresh/cfstep-gitclonerssh
24+
environment:
25+
- REMOTE_URL=git@github.com:my-user/my-repo.git
26+
- BRANCH=my-branch
27+
- SSH_KEY=${{SSH_KEY}}
28+
- SPLIT_CHAR=${{SPLIT_CHAR}}
29+
- CLONE_PATH=/codefresh/volume
30+
```

plugins/gitclonerssh/plugin.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
image: codefresh/cfstep-gitclonerssh
2+
tag: latest
3+
version: 0.1.0
4+
description: clone git repositories via SSH.
5+
keywords:
6+
- git
7+
- clone
8+
- ssh
9+
home: https://github.com/codefresh-io/cfstep-gitclonerssh
10+
sources:
11+
- https://github.com/codefresh-io/cfstep-gitclonerssh
12+
maintainers:
13+
- name: Francisco Cocozza
14+
email: francisco@codefresh.io
15+
icon: https://git-scm.com/images/logos/downloads/Git-Icon-1788C.png
16+
envs:
17+
- name: REMOTE_URL
18+
type: required
19+
description: Reporitory SSH URL (e.g. `git@github.com:my-user/my-repo.git`)
20+
- name: BRANCH
21+
type: optional
22+
description: Branch name to checkout (e.g. `master`)
23+
- name: SSH_KEY
24+
type: required
25+
description: Private SSH key to access the repository.
26+
- name: SPLIT_CHAR
27+
type: required
28+
description: Split character you’ve used to replace newline in SSH key
29+
- name: CLONE_PATH
30+
type: optional
31+
description: Path where `git clone` is going to be executed. A "`repo-name`" directory will be created there

0 commit comments

Comments
 (0)