rename sftp to scp.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-10-19 14:02:49 +08:00
parent d63cf1ae3a
commit 6731fdf7af
6 changed files with 16 additions and 16 deletions

View File

@ -1,5 +1,5 @@
FROM centurylink/ca-certs FROM centurylink/ca-certs
ADD drone-sftp / ADD drone-scp /
ENTRYPOINT ["/drone-sftp"] ENTRYPOINT ["/drone-scp"]

View File

@ -4,5 +4,5 @@ RUN apk update && \
apk add ca-certificates && \ apk add ca-certificates && \
rm -rf /var/cache/apk/* rm -rf /var/cache/apk/*
ADD drone-sftp /bin/ ADD drone-scp /bin/
ENTRYPOINT ["/bin/drone-sftp"] ENTRYPOINT ["/bin/drone-scp"]

View File

@ -2,7 +2,7 @@
VERSION := $(shell git describe --tags || git rev-parse --short HEAD) VERSION := $(shell git describe --tags || git rev-parse --short HEAD)
DEPLOY_ACCOUNT := "appleboy" DEPLOY_ACCOUNT := "appleboy"
DEPLOY_IMAGE := "drone-sftp" DEPLOY_IMAGE := "drone-scp"
ifneq ($(shell uname), Darwin) ifneq ($(shell uname), Darwin)
EXTLDFLAGS = -extldflags "-static" $(null) EXTLDFLAGS = -extldflags "-static" $(null)

View File

@ -1,6 +1,6 @@
# drone-sftp # drone-scp
[![Build Status](https://travis-ci.org/appleboy/drone-sftp.svg?branch=master)](https://travis-ci.org/appleboy/drone-sftp) [![codecov](https://codecov.io/gh/appleboy/drone-sftp/branch/master/graph/badge.svg)](https://codecov.io/gh/appleboy/drone-sftp) [![Go Report Card](https://goreportcard.com/badge/github.com/appleboy/drone-sftp)](https://goreportcard.com/report/github.com/appleboy/drone-sftp) [![Build Status](https://travis-ci.org/appleboy/drone-scp.svg?branch=master)](https://travis-ci.org/appleboy/drone-scp) [![codecov](https://codecov.io/gh/appleboy/drone-scp/branch/master/graph/badge.svg)](https://codecov.io/gh/appleboy/drone-scp) [![Go Report Card](https://goreportcard.com/badge/github.com/appleboy/drone-scp)](https://goreportcard.com/report/github.com/appleboy/drone-scp)
[Drone](https://github.com/drone/drone) plugin to publish files and artifacts via SFTP. [Drone](https://github.com/drone/drone) plugin to publish files and artifacts via SFTP.
@ -33,7 +33,7 @@ GCO disabled will result in an error when running the Docker image:
``` ```
docker: Error response from daemon: Container command docker: Error response from daemon: Container command
'/bin/drone-sftp' not found or does not exist.. '/bin/drone-scp' not found or does not exist..
``` ```
## Usage ## Usage
@ -56,5 +56,5 @@ docker run --rm \
-e DRONE_BUILD_LINK=http://github.com/appleboy/go-hello \ -e DRONE_BUILD_LINK=http://github.com/appleboy/go-hello \
-v $(pwd):$(pwd) \ -v $(pwd):$(pwd) \
-w $(pwd) \ -w $(pwd) \
appleboy/drone-sftp appleboy/drone-scp
``` ```

10
main.go
View File

@ -20,23 +20,23 @@ func main() {
cli.StringFlag{ cli.StringFlag{
Name: "host", Name: "host",
Usage: "Server host", Usage: "Server host",
EnvVar: "PLUGIN_HOST,SFTP_HOST", EnvVar: "PLUGIN_HOST,SCP_HOST",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "port", Name: "port",
Value: "22", Value: "22",
Usage: "Server port, default to 22", Usage: "Server port, default to 22",
EnvVar: "PLUGIN_PORT,SFTP_PORT", EnvVar: "PLUGIN_PORT,SCP_PORT",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "username", Name: "username",
Usage: "Server username", Usage: "Server username",
EnvVar: "PLUGIN_USERNAME,SFTP_USERNAME", EnvVar: "PLUGIN_USERNAME,SCP_USERNAME",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "password", Name: "password",
Usage: "Password for password-based authentication", Usage: "Password for password-based authentication",
EnvVar: "PLUGIN_PASSWORD,SFTP_PASSWORD", EnvVar: "PLUGIN_PASSWORD,SCP_PASSWORD",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "path", Name: "path",
@ -46,7 +46,7 @@ func main() {
}, },
cli.StringSliceFlag{ cli.StringSliceFlag{
Name: "files", Name: "files",
Usage: "sftp files list", Usage: "scp file list",
EnvVar: "PLUGIN_FILE", EnvVar: "PLUGIN_FILE",
}, },
cli.StringFlag{ cli.StringFlag{

View File

@ -61,9 +61,9 @@ func trimElement(keys []string) []string {
func (p Plugin) Exec() error { func (p Plugin) Exec() error {
if len(p.Config.Host) == 0 || len(p.Config.Username) == 0 || len(p.Config.Password) == 0 { if len(p.Config.Host) == 0 || len(p.Config.Username) == 0 || len(p.Config.Password) == 0 {
log.Println("missing sftp config") log.Println("missing ssh config")
return errors.New("missing sftp config") return errors.New("missing ssh config")
} }
return nil return nil