Update docs for Drone 0.6 and up
This commit is contained in:
57
DOCS.md
57
DOCS.md
@@ -14,10 +14,19 @@ The following parameters are used to configure the plugin:
|
|||||||
- **delete** - delete target folder contents, defaults to `false`
|
- **delete** - delete target folder contents, defaults to `false`
|
||||||
- **script** - list of commands to execute on remote machines
|
- **script** - list of commands to execute on remote machines
|
||||||
|
|
||||||
It is highly recommended to put your **key** into a secret so it is not exposed to users. This can be done using the drone-cli.
|
## Secrets
|
||||||
|
The following secrets can be used to secure the sensitive parts of your configuration:
|
||||||
|
- **rsync_key** - private SSH key for the remote machines
|
||||||
|
- **rsync_user** - user to log in as on the remote machines
|
||||||
|
|
||||||
|
It is highly recommended to put your private key into a secret (`rsync_key`) so it is not exposed to users. This can be done using the drone-cli:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
drone secret add octocat/hello-world RSYNC_KEY @path/to/.ssh/id_rsa
|
drone secret add \
|
||||||
|
--repository your/repo \
|
||||||
|
--name rsync_key \
|
||||||
|
--value @./id_rsa \
|
||||||
|
--image drillster/drone-rsync
|
||||||
```
|
```
|
||||||
|
|
||||||
Add the secret to your `.drone.yml`:
|
Add the secret to your `.drone.yml`:
|
||||||
@@ -26,28 +35,20 @@ pipeline:
|
|||||||
rsync:
|
rsync:
|
||||||
image: drillster/drone-rsync
|
image: drillster/drone-rsync
|
||||||
user: some-user
|
user: some-user
|
||||||
key: ${RSYNC_KEY}
|
|
||||||
hosts:
|
hosts:
|
||||||
- remote1
|
- remote1
|
||||||
source: ./dist
|
source: ./dist
|
||||||
target: ~/packages
|
target: ~/packages
|
||||||
|
secrets: [ rsync_key ]
|
||||||
```
|
```
|
||||||
|
|
||||||
Then sign the YAML file after all secrets are added.
|
See the [Secret Guide](http://docs.drone.io/manage-secrets/) for additional information on secrets.
|
||||||
|
|
||||||
```sh
|
|
||||||
drone sign octocat/hello-world
|
|
||||||
```
|
|
||||||
|
|
||||||
See the [Secret Guide](http://readme.drone.io/usage/secret-guide/) for additional information on secrets.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
```yaml
|
```yaml
|
||||||
pipeline:
|
pipeline:
|
||||||
rsync:
|
rsync:
|
||||||
image: drillster/drone-rsync
|
image: drillster/drone-rsync
|
||||||
user: some-user
|
|
||||||
key: ${RSYNC_KEY}
|
|
||||||
hosts:
|
hosts:
|
||||||
- remote1
|
- remote1
|
||||||
- remote2
|
- remote2
|
||||||
@@ -62,6 +63,7 @@ pipeline:
|
|||||||
- cd ~/packages
|
- cd ~/packages
|
||||||
- md5sum -c app.tar.gz.md5
|
- md5sum -c app.tar.gz.md5
|
||||||
- tar -xf app.tar.gz -C ~/app
|
- tar -xf app.tar.gz -C ~/app
|
||||||
|
secrets: [ rsync_user, rsync_key ]
|
||||||
```
|
```
|
||||||
|
|
||||||
The example above illustrates a situation where an app package (`app.tar.gz`) will be deployed to 2 remote hosts (`remote1` and `remote2`). An md5 checksum will be deployed as well. After deploying, the md5 checksum is used to check the deployed package. If successful the package is extracted.
|
The example above illustrates a situation where an app package (`app.tar.gz`) will be deployed to 2 remote hosts (`remote1` and `remote2`). An md5 checksum will be deployed as well. After deploying, the md5 checksum is used to check the deployed package. If successful the package is extracted.
|
||||||
@@ -69,23 +71,30 @@ The example above illustrates a situation where an app package (`app.tar.gz`) wi
|
|||||||
## Important
|
## Important
|
||||||
The script passed to **script** will be executed on remote machines directly after rsync completes to deploy the files. It will be executed step by step until a command returns a non-zero exit-code. If this happens, the entire plugin will exit and fail the build.
|
The script passed to **script** will be executed on remote machines directly after rsync completes to deploy the files. It will be executed step by step until a command returns a non-zero exit-code. If this happens, the entire plugin will exit and fail the build.
|
||||||
|
|
||||||
|
## Secrets in Drone 0.5
|
||||||
|
|
||||||
## SSH key secret in Drone >= 0.6
|
Secret injection has changed for Drone 0.6 and up. To use this plugin with Drone 0.5, use:
|
||||||
|
|
||||||
Secret injection has changed for Drone 0.6 and up. Register your SSH key secret using the drone-cli.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
drone secret update \
|
drone secret add octocat/hello-world RSYNC_KEY @path/to/.ssh/id_rsa
|
||||||
--repository your/repo \
|
|
||||||
--name plugin_key \
|
|
||||||
--value @./id_rsa \
|
|
||||||
--image drillster/drone-rsync
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Do not add a `key` parameter in `.drone.yml` configuration, but add:
|
to add the secret. Then add the secret to your `.drone.yml`:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
secrets: [ plugin_key ]
|
pipeline:
|
||||||
|
rsync:
|
||||||
|
image: drillster/drone-rsync
|
||||||
|
user: some-user
|
||||||
|
key: ${RSYNC_KEY}
|
||||||
|
hosts:
|
||||||
|
- remote1
|
||||||
|
source: ./dist
|
||||||
|
target: ~/packages
|
||||||
```
|
```
|
||||||
|
|
||||||
Using any other name will not work.
|
and then sign your configuration using:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
drone sign octocat/hello-world
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user