From 6917c02a545fefe3c279500d1f76cb5d129a40f7 Mon Sep 17 00:00:00 2001 From: Michael de Wit Date: Mon, 16 Jan 2017 15:06:10 +0100 Subject: [PATCH] Finish repository migration --- .drone.yml | 30 ------------------------------ DOCS.md | 16 ++++++++-------- Dockerfile | 3 +-- MAINTAINERS | 7 ++++++- Makefile | 12 ++++++++++++ README.md | 13 +++++-------- main.go | 5 +---- publish.sh | 25 +++++++++++++++++++++++++ 8 files changed, 58 insertions(+), 53 deletions(-) delete mode 100644 .drone.yml create mode 100644 Makefile create mode 100755 publish.sh diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index e4258a3..0000000 --- a/.drone.yml +++ /dev/null @@ -1,30 +0,0 @@ -workspace: - base: /go - path: src/github.com/drone-plugins/drone-email - -pipeline: - test: - image: golang:1.6 - environment: - - CGO_ENABLED=0 - - GOPATH=/go - commands: - - go vet - - go test -cover -coverprofile=coverage.out - - go build -ldflags "-s -w -X main.build=$DRONE_BUILD_NUMBER" -a -tags netgo - - latest: - image: plugins/docker - repo: plugins/email - tags: [ "latest", "1.0", "1" ] - when: - branch: master - event: push - -plugin: - name: Email - desc: Send build status notifications via Email - type: notify - image: plugins/drone-email - labels: - - email diff --git a/DOCS.md b/DOCS.md index 724dcf6..5aa05aa 100644 --- a/DOCS.md +++ b/DOCS.md @@ -21,7 +21,7 @@ The following is a sample configuration in your .drone.yml file: ```yaml pipeline: notify: - image: plugins/email + image: drillster/drone-email from: noreply@github.com host: smtp.mailgun.org username: octocat @@ -36,7 +36,7 @@ The Email plugin supports reading credentials and other parameters from the Dron ```diff pipeline: notify: - image: plugins/email + image: drillster/drone-email from: noreply@github.com host: smtp.mailgun.org - username: octocat @@ -48,9 +48,9 @@ pipeline: Use the command line utility to add the secrets to the store: ```sh -drone secret add --image=plugins/email \ +drone secret add --image=drillster/drone-email \ octocat/hello-world EMAIL_USERNAME octocat -drone secret add --image=plugins/email \ +drone secret add --image=drillster/drone-email \ octocat/hello-world EMAIL_PASSWORD 12345 ``` @@ -78,17 +78,17 @@ provided as a string or as a remote URL which gets fetched and parsed: * **subject** - A handlebars template to create a custom subject. For more details take a look at the [docs](http://handlebarsjs.com/). You can see the - default template [here](https://github.com/drone-plugins/drone-email/blob/master/defaults.go#L14) + default template [here](https://github.com/Drillster/drone-email/blob/master/defaults.go#L14) * **body** - A handlebars template to create a custom template. For more details take a look at the [docs](http://handlebarsjs.com/). You can see the - default template [here](https://github.com/drone-plugins/drone-email/blob/master/defaults.go#L19-L267) + default template [here](https://github.com/Drillster/drone-email/blob/master/defaults.go#L19-L267) Example configuration that generate a custom email: ```yaml pipeline: notify: - image: plugins/email + image: drillster/drone-email from: noreply@github.com host: smtp.mailgun.org username: octocat @@ -115,7 +115,7 @@ Example configuration that skips SSL verification: ```yaml pipeline: notify: - image: plugins/email + image: drillster/drone-email from: noreply@github.com host: smtp.mailgun.org username: octocat diff --git a/Dockerfile b/Dockerfile index 04f6c2f..742a656 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,6 @@ FROM alpine:3.4 -RUN apk update && \ - apk add --no-cache ca-certificates +RUN apk add --no-cache ca-certificates ADD drone-email /bin/ ENTRYPOINT ["/bin/drone-email"] diff --git a/MAINTAINERS b/MAINTAINERS index 0ecaf19..fe583f2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -31,6 +31,10 @@ name = "Aurélien Thieriot" email = "a.thieriot@gmail.com" login = "athieriot" + [people.mjwwit] + name = "Michael de Wit" + email = "mjwwit@gmail.com" + login = "mjwwit" [org] [org.core] @@ -42,5 +46,6 @@ "msteinert", "nlf", "tboerger", - "athieriot" + "athieriot", + "mjwwit" ] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e5f2b56 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +all: test build publish + +test: + go vet + go test -cover -coverprofile=coverage.out + +build: + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build + docker build -t drillster/drone-email:latest . + +publish: + publish.sh \ No newline at end of file diff --git a/README.md b/README.md index d548da4..bfbcfca 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ # drone-email -[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-email/status.svg)](http://beta.drone.io/drone-plugins/drone-email) -[![Go Doc](https://godoc.org/github.com/drone-plugins/drone-email?status.svg)](http://godoc.org/github.com/drone-plugins/drone-email) -[![Go Report](https://goreportcard.com/badge/github.com/drone-plugins/drone-email)](https://goreportcard.com/report/github.com/drone-plugins/drone-email) -[![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/Drillster/drone-email?status.svg)](http://godoc.org/github.com/Drillster/drone-email) +[![Go Report](https://goreportcard.com/badge/github.com/Drillster/drone-email)](https://goreportcard.com/report/github.com/Drillster/drone-email) Drone plugin to send build status notifications via Email. For the usage information and a listing of the available options please take a look at [the docs](DOCS.md). @@ -21,10 +18,10 @@ go build Build the docker image with the following commands: ``` -CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -docker build -t plugins/email . +make build ``` +This will create a Docker image called `drillster/drone-email:latest`. Please note incorrectly building the image for the correct x64 linux and with GCO disabled will result in an error when running the Docker image: ``` @@ -53,5 +50,5 @@ docker run --rm \ -e DRONE_COMMIT_MESSAGE="Hello world!" \ -v $(pwd):$(pwd) \ -w $(pwd) \ - plugins/email + drillster/drone-email ``` diff --git a/main.go b/main.go index 12d6e26..b59b4d9 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,6 @@ package main import ( - "fmt" "os" log "github.com/Sirupsen/logrus" @@ -9,8 +8,6 @@ import ( "github.com/urfave/cli" ) -var build = "0" // build number set at compile-time - func main() { // Load env-file if it exists first if env := os.Getenv("PLUGIN_ENV_FILE"); env != "" { @@ -21,7 +18,7 @@ func main() { app.Name = "email plugin" app.Usage = "email plugin" app.Action = run - app.Version = fmt.Sprintf("1.0.%s", build) + app.Version = "1.0.0" app.Flags = []cli.Flag{ // Plugin environment cli.StringFlag{ diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..8fb53c2 --- /dev/null +++ b/publish.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +tags=$(git tag --points-at HEAD) +IFS=$'\n' read -rd '' -a taglist <<<"$tags" + +if [ ${#taglist[@]} -gt 0 ]; then + echo "Tagging Docker images with: ${taglist[@]}" + for tag in "${taglist[@]}"; do + docker tag drillster/drone-email:latest drillster/drone-email:$tag + done +fi + +echo "Pushing Docker images..." +docker push drillster/drone-email:latest + +if [ "$?" -ne "0" ]; then + echo "Failed to push image, exiting!" + exit 1 +fi + +if [ ${#taglist[@]} -gt 0 ]; then + for tag in "${taglist[@]}"; do + docker push drillster/drone-email:$tag + done +fi \ No newline at end of file