From af5b4c752d8445cce0c1728c67b3ca2525b8c7c7 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 10:38:54 +0100 Subject: [PATCH 1/7] Added all task as first task to makefile --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d1cd996..ec52374 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: clean deps fmt vet test docker +.PHONY: all clean deps fmt vet test docker EXECUTABLE ?= drone-terraform IMAGE ?= plugins/$(EXECUTABLE) @@ -7,6 +7,8 @@ CI_BUILD_NUMBER ?= 0 LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')" PACKAGES = $(shell go list ./... | grep -v /vendor/) +all: deps build test + clean: go clean -i ./... From 651fadbc16e649b437fe4884d97e764bb10be615 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 10:43:09 +0100 Subject: [PATCH 2/7] Removed unused CI_BUILD_NUMBER from makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index ec52374..e717d01 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ EXECUTABLE ?= drone-terraform IMAGE ?= plugins/$(EXECUTABLE) -CI_BUILD_NUMBER ?= 0 LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')" PACKAGES = $(shell go list ./... | grep -v /vendor/) From 417188af50144573b08273f6fb753813057f6a6f Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 11:06:41 +0100 Subject: [PATCH 3/7] Make the builds reproducable based on commit sha --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e717d01..0dc93e2 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ EXECUTABLE ?= drone-terraform IMAGE ?= plugins/$(EXECUTABLE) +COMMIT ?= $(shell git rev-parse --short HEAD) -LDFLAGS = -X "main.buildDate=$(shell date -u '+%Y-%m-%d %H:%M:%S %Z')" +LDFLAGS = -X "main.buildCommit=$(COMMIT)" PACKAGES = $(shell go list ./... | grep -v /vendor/) all: deps build test From f90e4b45ae4a079983473a223d3628572e8f042b Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 11:20:32 +0100 Subject: [PATCH 4/7] Added initial maintainers file --- MAINTAINERS | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 MAINTAINERS diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..0ecaf19 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,46 @@ +[people] + [people.bradrydzewski] + name = "Brad Rydzewski" + email = "brad@drone.io" + login = "bradrydzewski" + [people.Bugagazavr] + name = "Kirill" + email = "" + login = "Bugagazavr" + [people.donny-dont] + name = "Don Olmstead" + email = "donny-dont@gmail.com" + login = "donny-dont" + [people.jackspirou] + name = "Jack Spirou" + email = "" + login = "jackspirou" + [people.msteinert] + name = "Mike Steinert" + email = "" + login = "msteinert" + [people.nlf] + name = "Nathan LaFreniere" + email = "" + login = "nlf" + [people.tboerger] + name = "Thomas Boerger" + email = "thomas@webhippie.de" + login = "tboerger" + [people.athieriot] + name = "Aurélien Thieriot" + email = "a.thieriot@gmail.com" + login = "athieriot" + +[org] + [org.core] + people = [ + "bradrydzewski", + "Bugagazavr", + "donny-dont", + "jackspirou", + "msteinert", + "nlf", + "tboerger", + "athieriot" + ] From 078e90334f6f0a4db84c1343074ca69c62540505 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 11:38:18 +0100 Subject: [PATCH 5/7] Updated gitignore to respect also coverage.out --- .gitignore | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.gitignore b/.gitignore index e69de29..2749df5 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,27 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof + +coverage.out +drone-terraform From 99c73fbdf6d53b0a1e70b60aac025d04d07dac11 Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 12:38:13 +0100 Subject: [PATCH 6/7] Added a similar README as for the other drone plugins --- README.md | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 120 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 101123a..dc0ca3a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,123 @@ -# Drone Terraform Deploy Plugin +# drone-terraform -This project provides a [Drone](drone.io) plugin docker image that contains the [Terraform](terraform.io) binaries and a small Go app that receives the Drone meta-data and executes Terraform commands. +[![Build Status](http://beta.drone.io/api/badges/drone-plugins/drone-terraform/status.svg)](http://beta.drone.io/drone-plugins/drone-terraform) +[![Coverage Status](https://aircover.co/badges/drone-plugins/drone-terraform/coverage.svg)](https://aircover.co/drone-plugins/drone-terraform) +[![](https://badge.imagelayers.io/plugins/drone-terraform:latest.svg)](https://imagelayers.io/?images=plugins/drone-terraform:latest 'Get your own badge on imagelayers.io') -Documentation for Drone Plugin development can be found here: http://readme.drone.io/plugin/ +Drone plugin to execute Terraform plan and apply. For the usage information and a listing of the available options please take a look at [the docs](DOCS.md). -See [DOCS](DOCS.md) for details on this plugin's configuration and usage. +## Binary + +Build the binary using `make`: + +``` +make deps build +``` + +### Example + +```sh +./drone-terraform < Date: Sun, 21 Feb 2016 12:41:22 +0100 Subject: [PATCH 7/7] Print out the plugin version to help debugging --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 181a5ee..4e4d0ab 100644 --- a/main.go +++ b/main.go @@ -2,14 +2,18 @@ package main import ( "fmt" + "io/ioutil" "os" "os/exec" "strings" - "io/ioutil" "github.com/drone/drone-plugin-go/plugin" ) +var ( + buildCommit string +) + type terraform struct { Remote remote `json:"remote"` Plan bool `json:"plan"` @@ -24,6 +28,7 @@ type remote struct { } func main() { + fmt.Printf("Drone Terraform Plugin built from %s\n", buildCommit) workspace := plugin.Workspace{} vargs := terraform{}