diff --git a/.drone.sh b/.drone.sh deleted file mode 100644 index 591145e..0000000 --- a/.drone.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e -set -x - -# compile the main binary -GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/amd64/drone-webhook -GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm64/drone-webhook -GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o release/linux/arm/drone-webhook diff --git a/.drone.yml b/.drone.yml index 26e1c7a..264f537 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,8 +11,34 @@ pipeline: build_linux_amd64: image: golang:1.9 + group: build + environment: + - GOOS=linux + - GOARCH=amd64 + - CGO_ENABLED=0 commands: - - sh .drone.sh + - go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-webhook + + build_linux_arm64: + image: golang:1.9 + group: build + environment: + - GOOS=linux + - GOARCH=arm64 + - CGO_ENABLED=0 + commands: + - go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-webhook + + build_linux_arm: + image: golang:1.9 + group: build + environment: + - GOOS=linux + - GOARCH=arm + - CGO_ENABLED=0 + - GOARM=7 + commands: + - go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-webhook publish_linux_amd64: image: plugins/docker diff --git a/.gitignore b/.gitignore index 2b8f76c..11c1d94 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ _testmain.go *.exe *.test *.prof -.idea/ release/ coverage.out drone-webhook diff --git a/Dockerfile b/Dockerfile index e6471b4..0edecc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,18 @@ -FROM alpine:3.3 +FROM alpine:3.6 as alpine +RUN apk add -U --no-cache ca-certificates + +FROM scratch MAINTAINER Drone.IO Community -RUN apk update && \ - apk add \ - ca-certificates && \ - rm -rf /var/cache/apk/* +ENV GODEBUG=netdns=go + +COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ + +LABEL org.label-schema.version=latest +LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git" +LABEL org.label-schema.name="Drone S3 Webhook" +LABEL org.label-schema.vendor="Drone.IO Community" + ADD release/linux/amd64/drone-webhook /bin/ ENTRYPOINT ["/bin/drone-webhook"] diff --git a/Dockerfile.arm b/Dockerfile.arm index b47e7b7..95d4db1 100644 --- a/Dockerfile.arm +++ b/Dockerfile.arm @@ -1,10 +1,18 @@ -FROM alpine:3.3 +FROM alpine:3.6 as alpine +RUN apk add -U --no-cache ca-certificates + +FROM scratch MAINTAINER Drone.IO Community -RUN apk update && \ - apk add \ - ca-certificates && \ - rm -rf /var/cache/apk/* +ENV GODEBUG=netdns=go + +COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ + +LABEL org.label-schema.version=latest +LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git" +LABEL org.label-schema.name="Drone Webhook" +LABEL org.label-schema.vendor="Drone.IO Community" +LABEL org.label-schema.schema-version="1.0" ADD release/linux/arm/drone-webhook /bin/ ENTRYPOINT ["/bin/drone-webhook"] \ No newline at end of file diff --git a/Dockerfile.arm64 b/Dockerfile.arm64 index 0c05341..1572e54 100644 --- a/Dockerfile.arm64 +++ b/Dockerfile.arm64 @@ -1,10 +1,20 @@ -FROM alpine:3.3 + +FROM alpine:3.6 as alpine +RUN apk add -U --no-cache ca-certificates mailcap + +FROM scratch MAINTAINER Drone.IO Community -RUN apk update && \ - apk add \ - ca-certificates && \ - rm -rf /var/cache/apk/* +ENV GODEBUG=netdns=go + +COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=alpine /etc/mime.types /etc/ + +LABEL org.label-schema.version=latest +LABEL org.label-schema.vcs-url="https://github.com/drone-plugins/drone-webhook.git" +LABEL org.label-schema.name="Drone Webhook" +LABEL org.label-schema.vendor="Drone.IO Community" +LABEL org.label-schema.schema-version="1.0" ADD release/linux/arm64/drone-webhook /bin/ ENTRYPOINT ["/bin/drone-webhook"] \ No newline at end of file diff --git a/README.md b/README.md index 20e3247..291512c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # drone-webhook [![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-webhook/status.svg)](http://beta.drone.io/drone-plugins/drone-webhook) +[![Join the chat at https://gitter.im/drone/drone](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/drone/drone) +[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-webhook?status.svg)](http://godoc.org/github.com/drone-plugins/drone-webhook) +[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-webhook)](https://goreportcard.com/report/github.com/drone-plugins/drone-webhook) +[![](https://images.microbadger.com/badges/image/plugins/webhook.svg)](https://microbadger.com/images/plugins/webhook "Get your own image badge on microbadger.com") Drone plugin to send build status notifications via Webhook. For the usage information and a listing of the available options please take a look at [the docs](DOCS.md). diff --git a/main.go b/main.go index 5e84c45..d28de15 100644 --- a/main.go +++ b/main.go @@ -11,14 +11,14 @@ const ( respFormat = "Webhook %d\n URL: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n" debugRespFormat = "Webhook %d\n URL: %s\n METHOD: %s\n HEADERS: %s\n REQUEST BODY: %s\n RESPONSE STATUS: %s\n RESPONSE BODY: %s\n" ) -var version string +var build string func main() { app := cli.NewApp() app.Name = "rancher publish" app.Usage = "rancher publish" app.Action = run - app.Version = version + app.Version = fmt.Sprintf("1.0.0+%s", build) app.Flags = []cli.Flag{ cli.StringFlag{ Name: "method", @@ -29,12 +29,12 @@ func main() { cli.StringFlag{ Name: "username", Usage: "Username for basic auth", - EnvVar: "PLUGIN_USERNAME, WEBHOOK_USERNAME", + EnvVar: "PLUGIN_USERNAME,WEBHOOK_USERNAME", }, cli.StringFlag{ Name: "password", Usage: "Password for basic auth", - EnvVar: "PLUGIN_PASSWORD, WEBHOOK_PASSWORD", + EnvVar: "PLUGIN_PASSWORD,WEBHOOK_PASSWORD", }, cli.StringFlag{ Name: "content-type", @@ -157,7 +157,7 @@ func main() { } func run(c *cli.Context) error { - fmt.Printf("Drone Webhook Plugin built from %s\n", version) + fmt.Printf("Drone Webhook Plugin built from %s\n", build) plugin := Plugin{ Repo: Repo{