diff --git a/.drone.yml b/.drone.yml index 90f5079..7d547b5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,14 +1,10 @@ build: image: golang:1.5 - environment: - - GO15VENDOREXPERIMENT=1 - - GOOS=linux - - GOARCH=amd64 - - CGO_ENABLED=0 commands: - - go get - - go build - - go test + - make deps + - make vet + - make build + - make test publish: docker: @@ -21,7 +17,7 @@ publish: plugin: name: SSH - desc: Use SSH to execute commands on a remote host + desc: Execute commands on a remote host through SSH type: deploy image: plugins/drone-ssh labels: diff --git a/.gitignore b/.gitignore index a0a8502..fbd289b 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,4 @@ _testmain.go *.test *.prof -drone-ssh \ No newline at end of file +drone-ssh diff --git a/Dockerfile b/Dockerfile index 2e09c02..951bcdc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,14 @@ -# Docker image for the Drone build runner +# Docker image for the Drone Swift plugin # -# CGO_ENABLED=0 go build -a -tags netgo -# docker build --rm=true -t plugins/drone-ssh . +# cd $GOPATH/src/github.com/drone-plugins/drone-ssh +# make deps build docker + +FROM alpine:3.3 + +RUN apk update && \ + apk add \ + ca-certificates && \ + rm -rf /var/cache/apk/* -FROM gliderlabs/alpine:3.1 ADD drone-ssh /bin/ -ENTRYPOINT ["/bin/drone-ssh"] \ No newline at end of file +ENTRYPOINT ["/bin/drone-ssh"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..af971e3 --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +.PHONY: clean deps test build docker + +export GOOS ?= linux +export GOARCH ?= amd64 +export CGO_ENABLED ?= 0 + +CI_BUILD_NUMBER ?= 0 + +LDFLAGS += -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')" +LDFLAGS += -X "main.build=$(CI_BUILD_NUMBER)" + +clean: + go clean -i ./... + +deps: + go get -t ./... + +test: + go test -cover ./... + +fmt: + go fmt ./... + +vet: + go vet ./... + +build: + go build -ldflags '-s -w $(LDFLAGS)' + +docker: + docker build --rm=true -t plugins/drone-ssh . diff --git a/README.md b/README.md index 038158f..66735fc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,82 @@ # drone-ssh -Drone plugin for executing remote ssh commands + +[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-ssh/status.svg)](http://beta.drone.io/drone-plugins/drone-ssh) +[![](https://badge.imagelayers.io/plugins/drone-ssh:latest.svg)](https://imagelayers.io/?images=plugins/drone-ssh:latest 'Get your own badge on imagelayers.io') + +Drone plugin for executing commands on a remote host through SSH + +## Usage + +``` +./drone-ssh <