Skip to content

Commit

Permalink
Reproducible builds with trimpath (sigstore#944)
Browse files Browse the repository at this point in the history
Included -trimpath flag for able to have reproducible builds.

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
  • Loading branch information
naveensrinivasan committed Oct 23, 2021
1 parent b753a22 commit be6ab36
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ help: # Display help
SRCS = $(shell find cmd -iname "*.go") $(shell find pkg -iname "*.go")

cosign: $(SRCS)
CGO_ENABLED=0 go build -ldflags $(LDFLAGS) -o $@ ./cmd/cosign
CGO_ENABLED=0 go build -trimpath -ldflags $(LDFLAGS) -o $@ ./cmd/cosign

cosign-pivkey: $(SRCS)
CGO_ENABLED=1 go build -tags=pivkey -ldflags $(LDFLAGS) -o cosign ./cmd/cosign
CGO_ENABLED=1 go build -trimpath -tags=pivkey -ldflags $(LDFLAGS) -o cosign ./cmd/cosign

GOLANGCI_LINT_DIR = $(shell pwd)/bin
GOLANGCI_LINT_BIN = $(GOLANGCI_LINT_DIR)/golangci-lint
Expand All @@ -78,7 +78,7 @@ ARCHITECTURES=amd64
cross:
$(foreach GOOS, $(PLATFORMS),\
$(foreach GOARCH, $(ARCHITECTURES), $(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); \
go build -ldflags $(LDFLAGS) -o cosign-$(GOOS)-$(GOARCH) ./cmd/cosign; \
go build -trimpath -ldflags $(LDFLAGS) -o cosign-$(GOOS)-$(GOARCH) ./cmd/cosign; \
shasum -a 256 cosign-$(GOOS)-$(GOARCH) > cosign-$(GOOS)-$(GOARCH).sha256 ))) \

test:
Expand Down Expand Up @@ -126,8 +126,8 @@ snapshot:

.PHONY: cosigned
cosigned: lint ## Build cosigned binary
CGO_ENABLED=0 go build -ldflags $(LDFLAGS) -o $@ ./cmd/cosign/webhook
CGO_ENABLED=0 go build -trimpath -ldflags $(LDFLAGS) -o $@ ./cmd/cosign/webhook

.PHONY: sget
sget: ## Build sget binary
go build -o $@ ./cmd/sget
go build -trimpath -o $@ ./cmd/sget

0 comments on commit be6ab36

Please sign in to comment.