From 5ac45ceff9bc30cb42a7c1be2db241bcf5976f5e Mon Sep 17 00:00:00 2001 From: Thomas Boerger Date: Sun, 21 Feb 2016 11:06:41 +0100 Subject: [PATCH] Make the builds reproducable based on commit sha --- Makefile | 3 ++- main.go | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 305d679..54eba0f 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ EXECUTABLE ?= drone-webhook 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 diff --git a/main.go b/main.go index 253e839..d861248 100644 --- a/main.go +++ b/main.go @@ -20,11 +20,11 @@ const ( ) var ( - buildDate string + buildCommit string ) func main() { - fmt.Printf("Drone Webhook Plugin built at %s\n", buildDate) + fmt.Printf("Drone Webhook Plugin built from %s\n", buildCommit) system := drone.System{} repo := drone.Repo{}