Make the builds reproducable based on commit sha

This commit is contained in:
Thomas Boerger 2016-02-21 11:06:41 +01:00
parent 89fcebf89a
commit 0be1d32b32
2 changed files with 4 additions and 3 deletions

View File

@ -2,8 +2,9 @@
EXECUTABLE ?= drone-s3-sync
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

View File

@ -24,11 +24,11 @@ type result struct {
}
var (
buildDate string
buildCommit string
)
func main() {
fmt.Printf("Drone S3 Sync Plugin built at %s\n", buildDate)
fmt.Printf("Drone S3 Sync Plugin built from %s\n", buildCommit)
vargs := PluginArgs{}
workspace := drone.Workspace{}