1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-12 08:23:48 +02:00
woodpecker/docs/build/clone.md

54 lines
1.9 KiB
Markdown
Raw Normal View History

2015-07-07 06:13:50 +02:00
# Clone
2015-07-08 03:08:43 +02:00
Drone automatically clones your repository and submodules at the start of your build. No configuration is required. You can, however, use the `clone` section of the `.drone.yml` to customize this behavior as needed.
2015-07-07 06:13:50 +02:00
## Clone Options
The custom clone options are:
2015-07-08 03:08:43 +02:00
* `depth` - creates a shallow clone with truncated history
* `recursive` - recursively clones git submodules
* `path` - relative path inside `/drone/src` where the repository is cloned
2015-07-07 06:13:50 +02:00
This is an example yaml configuration:
2015-07-08 03:08:43 +02:00
```yaml
2015-07-07 06:13:50 +02:00
clone:
depth: 50
recursive: true
path: github.com/drone/drone
```
2015-07-08 03:08:43 +02:00
Which results in the following command:
2015-07-07 06:13:50 +02:00
```
git clone --depth=50 --recusive=true \
https://github.com/drone/drone.git \
/drone/src/github.com/drone/drone
```
2015-07-08 03:08:43 +02:00
## Clone Private Repos
2015-07-07 06:13:50 +02:00
2015-07-08 03:08:43 +02:00
Cloning a private repository requires authentication to the remote system. Drone prefers `git+https` and `netrc` to authenticate, but will fallback to `git+ssh` and deploy keys if not supported.
2015-07-07 06:13:50 +02:00
2015-07-10 02:01:03 +02:00
Drone prefers `git+https` for authentication because it allows you to clone multiple private repositories. This is helpful when you have git submodules or third party dependencies you need to download (via `go get` or `npm install` or others) that are sourced from a private repository.
2015-07-07 06:13:50 +02:00
2015-07-08 03:08:43 +02:00
Drone only injects the `netrc` and `id_rsa` files into your build environment if your repository is private, or running in private mode. We do this for security reasons to avoid leaking sensitive data.
2015-07-07 06:13:50 +02:00
2015-07-10 02:01:03 +02:00
## Clone Plugin
2015-07-07 06:13:50 +02:00
You can override the default `git` plugin by specifying an alternative plugin image. An example use case may be integrating with alternate version control systems, such as mercurial:
2015-07-08 03:08:43 +02:00
```yaml
2015-07-07 06:13:50 +02:00
clone:
image: bradrydzewski/hg
2015-07-08 03:08:43 +02:00
# below are plugin-specific parameters
2015-07-07 06:13:50 +02:00
path: override/default/clone/path
insecure: false
verbose: true
```
Please reference the official `git` plugin and use this as a starting point for custom plugin development:
https://github.com/drone-plugins/drone-git