mirror of
https://github.com/appleboy/drone-scp.git
synced 2026-06-04 10:15:05 +08:00
docs: [ci skip] add drone docs. (#23)
This commit is contained in:
@@ -0,0 +1,197 @@
|
||||
---
|
||||
date: 2017-01-06T00:00:00+00:00
|
||||
title: SCP
|
||||
author: appleboy
|
||||
tags: [ ssh, scp ]
|
||||
repo: appleboy/drone-scp
|
||||
logo: scp.svg
|
||||
image: appleboy/drone-scp
|
||||
---
|
||||
|
||||
The Scp plugin copy files and artifacts to target host machine via SSH. The below pipeline configuration demonstrates simple usage:
|
||||
|
||||
```yaml
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
```
|
||||
|
||||
Example configuration with custom username, password and port:
|
||||
|
||||
```diff
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
+ username: appleboy
|
||||
+ password: 12345678
|
||||
+ port: 4430
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
```
|
||||
|
||||
Example configuration with multiple source and target folder:
|
||||
|
||||
```diff
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
target:
|
||||
+ - /home/deploy/web1
|
||||
+ - /home/deploy/web2
|
||||
source:
|
||||
+ - release_1.tar.gz
|
||||
+ - release_2.tar.gz
|
||||
```
|
||||
|
||||
Example configuration with multiple host:
|
||||
|
||||
```diff
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
- host: example.com
|
||||
+ host:
|
||||
+ - example1.com
|
||||
+ - example2.com
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
```
|
||||
|
||||
Remove target folder before copy files and artifacts to target:
|
||||
|
||||
```diff
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
+ rm: true
|
||||
```
|
||||
|
||||
Example configuration for success build:
|
||||
|
||||
```diff
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
+ when:
|
||||
+ status: success
|
||||
```
|
||||
|
||||
Example configuration for tag event:
|
||||
|
||||
```diff
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
+ when:
|
||||
+ status: success
|
||||
+ event: tag
|
||||
```
|
||||
|
||||
# Secrets
|
||||
|
||||
The SCP plugin supports reading credentials from the Drone secret store. This is strongly recommended instead of storing credentials in the pipeline configuration in plain text.
|
||||
|
||||
```diff
|
||||
pipeline:
|
||||
scp:
|
||||
image: appleboy/drone-scp
|
||||
host: example.com
|
||||
username: appleboy
|
||||
- password: 12345678
|
||||
port: 4430
|
||||
target: /home/deploy/web
|
||||
source: release.tar.gz
|
||||
```
|
||||
|
||||
The above webhook Yaml attribute can be replaced with the `SCP_PASSWORD` secret environment variable. Please see the Drone documentation to learn more about secrets.
|
||||
|
||||
It is highly recommended to put the `SCP_PASSWORD` or `SCP_KEY` into a secret so it is not exposed to users. This can be done using the drone-cli.
|
||||
|
||||
```bash
|
||||
drone secret add --image=appleboy/drone-scp \
|
||||
appleboy/hello-world SCP_PASSWORD 12345678
|
||||
drone secret add --image=appleboy/drone-scp \
|
||||
appleboy/hello-world SSH_KEY @path/to/.ssh/id_rsa
|
||||
```
|
||||
|
||||
Then sign the YAML file after all secrets are added.
|
||||
|
||||
```bash
|
||||
drone sign appleboy/hello-world
|
||||
```
|
||||
|
||||
See [secrets](http://readme.drone.io/0.5/usage/secrets/) for additional information on secrets
|
||||
|
||||
# Parameter Reference
|
||||
|
||||
host
|
||||
: target hostname or IP
|
||||
|
||||
port
|
||||
: ssh port of target host
|
||||
|
||||
username
|
||||
: account for target host user
|
||||
|
||||
password
|
||||
: password for target host user
|
||||
|
||||
key
|
||||
: plain text of user public key
|
||||
|
||||
target
|
||||
: folder path of target host
|
||||
|
||||
source
|
||||
: source lists you want to copy
|
||||
|
||||
rm
|
||||
: remove target folder before copy files and artifacts
|
||||
|
||||
# Template Reference
|
||||
|
||||
repo.owner
|
||||
: repository owner
|
||||
|
||||
repo.name
|
||||
: repository name
|
||||
|
||||
build.status
|
||||
: build status type enumeration, either `success` or `failure`
|
||||
|
||||
build.event
|
||||
: build event type enumeration, one of `push`, `pull_request`, `tag`, `deployment`
|
||||
|
||||
build.number
|
||||
: build number
|
||||
|
||||
build.commit
|
||||
: git sha for current commit
|
||||
|
||||
build.branch
|
||||
: git branch for current commit
|
||||
|
||||
build.tag
|
||||
: git tag for current commit
|
||||
|
||||
build.ref
|
||||
: git ref for current commit
|
||||
|
||||
build.author
|
||||
: git author for current commit
|
||||
|
||||
build.link
|
||||
: link the the build results in drone
|
||||
@@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
|
||||
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
||||
width="2400.000000pt" height="2400.000000pt" viewBox="0 0 2400.000000 2400.000000"
|
||||
preserveAspectRatio="xMidYMid meet">
|
||||
<metadata>
|
||||
Created by potrace 1.11, written by Peter Selinger 2001-2013
|
||||
</metadata>
|
||||
<g transform="translate(0.000000,2400.000000) scale(0.100000,-0.100000)"
|
||||
fill="#000000" stroke="none">
|
||||
<path d="M8816 22953 c-3 -16 -73 -417 -156 -893 -82 -476 -153 -871 -157
|
||||
-878 -5 -7 -73 -39 -153 -71 -1549 -625 -2944 -1665 -3986 -2971 -1080 -1354
|
||||
-1787 -2968 -2039 -4650 -14 -96 -31 -186 -36 -199 -20 -49 -60 -433 -79 -765
|
||||
-13 -230 -13 -808 0 -1051 12 -218 31 -422 62 -683 l22 -184 -40 -37 c-83 -78
|
||||
-194 -180 -304 -281 -63 -58 -146 -134 -185 -170 -84 -79 -99 -92 -522 -484
|
||||
-183 -168 -334 -310 -337 -315 -3 -4 122 -228 277 -497 155 -269 881 -1525
|
||||
1612 -2791 731 -1267 1334 -2303 1340 -2303 6 0 85 27 176 61 90 33 286 105
|
||||
434 159 880 322 1096 400 1104 400 6 0 36 -22 69 -49 183 -153 632 -469 927
|
||||
-653 500 -312 1151 -630 1760 -858 1454 -545 3063 -737 4605 -550 823 100
|
||||
1654 308 2395 600 99 39 189 72 200 74 54 9 374 155 690 314 513 260 962 538
|
||||
1433 889 l193 143 52 -16 c29 -9 66 -20 82 -26 47 -15 503 -157 570 -177 116
|
||||
-35 650 -202 675 -211 14 -5 72 -23 130 -40 58 -18 147 -45 198 -62 51 -16 97
|
||||
-28 102 -26 12 4 3232 5579 3228 5588 -3 7 -195 169 -998 838 -201 168 -373
|
||||
313 -384 322 -18 18 -18 21 2 167 111 782 124 1556 41 2373 -192 1889 -916
|
||||
3661 -2105 5152 -762 956 -1725 1780 -2794 2391 -335 191 -801 420 -1137 557
|
||||
-46 18 -85 41 -87 49 -3 9 -96 419 -206 911 -111 492 -204 903 -206 913 -5 16
|
||||
-168 17 -3234 17 l-3228 0 -6 -27z m5928 -510 c8 -27 235 -999 316 -1353 39
|
||||
-173 75 -328 79 -345 7 -28 18 -34 197 -103 394 -152 864 -370 1189 -552 1060
|
||||
-592 1973 -1362 2720 -2290 1164 -1447 1863 -3202 2014 -5055 33 -401 39
|
||||
-1112 11 -1445 -26 -320 -75 -695 -132 -1013 l-12 -67 44 -43 c25 -23 86 -76
|
||||
135 -117 50 -41 95 -80 102 -86 6 -6 57 -49 114 -95 56 -46 145 -120 198 -164
|
||||
53 -45 224 -188 381 -319 382 -320 355 -295 343 -315 -5 -9 -612 -1059 -1347
|
||||
-2333 -804 -1393 -1344 -2318 -1352 -2318 -8 0 -88 22 -177 49 -89 27 -178 54
|
||||
-197 59 -42 11 -449 134 -535 161 -33 11 -100 31 -150 46 -49 15 -99 31 -110
|
||||
35 -11 5 -40 14 -65 20 -25 6 -54 15 -65 20 -11 5 -51 18 -90 28 -38 11 -125
|
||||
37 -192 57 -121 37 -122 37 -147 19 -13 -11 -89 -71 -168 -135 -242 -196 -689
|
||||
-519 -717 -519 -5 0 -50 -26 -98 -57 -467 -301 -1049 -599 -1582 -810 -902
|
||||
-357 -1797 -559 -2816 -635 -223 -16 -967 -16 -1190 0 -1303 97 -2449 410
|
||||
-3565 973 -578 291 -1182 679 -1635 1049 -38 32 -75 59 -82 61 -6 2 -55 42
|
||||
-108 88 l-97 83 -47 -10 c-45 -10 -110 -32 -431 -152 -91 -34 -311 -115 -490
|
||||
-180 -179 -65 -399 -146 -490 -179 -90 -34 -169 -61 -175 -61 -6 0 -617 1051
|
||||
-1359 2336 l-1349 2336 34 30 c19 17 108 101 199 187 91 85 194 183 230 216
|
||||
36 34 108 102 160 152 52 50 119 112 149 139 30 27 71 65 92 84 68 64 261 245
|
||||
288 269 14 13 56 52 92 87 l67 64 -14 72 c-50 260 -105 734 -109 928 -1 80 -6
|
||||
296 -10 480 -12 533 20 1039 100 1565 390 2571 1841 4857 4000 6300 631 423
|
||||
1339 780 2020 1020 115 41 120 44 128 76 10 40 75 405 198 1114 50 286 93 530
|
||||
96 543 l5 22 2698 0 c2562 0 2699 -1 2704 -17z"/>
|
||||
<path d="M11640 19006 l0 -515 -42 -5 c-24 -2 -137 -14 -252 -26 -1014 -101
|
||||
-2043 -474 -2917 -1056 -699 -465 -1328 -1094 -1793 -1793 -314 -471 -591
|
||||
-1038 -765 -1567 -484 -1466 -435 -3040 139 -4470 40 -99 110 -257 156 -353
|
||||
46 -96 84 -177 84 -181 0 -4 -220 -134 -490 -290 -269 -155 -496 -287 -505
|
||||
-294 -13 -9 12 -58 182 -353 109 -189 201 -343 204 -343 4 0 233 130 509 290
|
||||
276 160 505 290 510 290 4 0 49 -58 99 -129 440 -618 1030 -1189 1670 -1615
|
||||
471 -314 1038 -591 1567 -765 1335 -441 2753 -441 4088 0 529 174 1096 451
|
||||
1567 765 648 431 1226 992 1683 1634 59 83 109 150 112 150 2 0 226 -128 497
|
||||
-284 270 -157 499 -288 508 -291 12 -5 59 69 213 336 178 307 196 344 181 355
|
||||
-9 7 -237 139 -506 294 -269 156 -489 286 -489 290 0 4 33 76 74 161 554 1156
|
||||
745 2548 525 3839 -153 901 -498 1771 -1005 2531 -401 603 -917 1147 -1504
|
||||
1588 -326 244 -618 424 -1000 615 -707 353 -1451 571 -2206 646 -115 12 -228
|
||||
24 -251 26 l-43 5 0 515 0 514 -400 0 -400 0 0 -514z m0 -2876 l0 -1160 -456
|
||||
0 c-265 0 -454 -4 -452 -9 10 -29 1324 -2571 1328 -2571 4 0 1317 2542 1328
|
||||
2571 2 5 -197 9 -472 9 l-476 0 0 1160 0 1160 45 0 c141 0 562 -70 846 -141
|
||||
382 -95 684 -207 1054 -389 404 -199 729 -410 1080 -701 153 -126 546 -526
|
||||
678 -688 195 -241 376 -505 525 -767 80 -141 244 -483 306 -641 460 -1162 498
|
||||
-2453 106 -3631 -89 -268 -249 -652 -272 -652 -12 0 -1848 1058 -1867 1076
|
||||
-12 10 21 74 207 396 122 211 222 387 222 393 0 10 7 10 -230 20 -96 4 -182 8
|
||||
-190 10 -8 1 -98 6 -200 9 -102 4 -207 9 -235 11 -27 2 -117 7 -200 10 -82 3
|
||||
-170 8 -195 10 -25 2 -124 7 -220 11 -96 3 -190 7 -208 9 -18 1 -110 6 -205
|
||||
10 -94 4 -188 8 -207 10 -19 2 -120 6 -225 10 -104 4 -197 8 -205 10 -38 7
|
||||
-370 17 -370 11 0 -4 284 -449 632 -989 347 -540 699 -1087 782 -1215 135
|
||||
-210 151 -232 163 -216 7 10 115 195 240 411 l227 393 30 -18 c17 -10 439
|
||||
-254 939 -542 499 -288 907 -528 907 -533 0 -15 -148 -214 -269 -362 -123
|
||||
-151 -521 -554 -666 -674 -220 -183 -463 -355 -705 -501 -169 -103 -570 -300
|
||||
-757 -374 -1266 -500 -2660 -500 -3926 0 -187 74 -588 271 -757 374 -242 146
|
||||
-487 319 -705 501 -142 118 -523 501 -645 649 -114 137 -274 349 -269 355 2 2
|
||||
411 238 909 525 498 287 919 531 937 541 l31 19 218 -377 c120 -208 223 -386
|
||||
230 -396 10 -16 19 -6 73 80 34 54 123 193 198 308 74 116 186 289 248 385
|
||||
106 166 450 701 540 840 23 36 124 193 225 350 101 157 207 322 236 367 30 46
|
||||
54 88 54 94 0 7 -24 9 -77 5 -43 -3 -139 -8 -213 -11 -74 -3 -169 -7 -210 -10
|
||||
-81 -5 -221 -12 -420 -20 -69 -3 -159 -7 -200 -10 -41 -3 -131 -7 -200 -10
|
||||
-127 -5 -242 -11 -417 -20 -54 -3 -197 -10 -318 -15 -121 -5 -264 -12 -317
|
||||
-15 -54 -3 -142 -7 -195 -10 -243 -12 -323 -18 -323 -24 0 -3 105 -189 234
|
||||
-411 l234 -405 -27 -16 c-87 -55 -1851 -1069 -1859 -1069 -12 0 -105 198 -177
|
||||
376 -291 718 -424 1539 -375 2309 57 888 328 1732 798 2490 103 166 260 384
|
||||
399 556 132 162 525 562 678 688 351 291 676 502 1080 701 370 182 672 294
|
||||
1054 389 288 72 679 138 834 140 l57 1 0 -1160z"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.0 KiB |
Reference in New Issue
Block a user