Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Generate release binaries #285

Merged
merged 6 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/hubble
/release
install/kubernetes/hubble.yaml
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,23 @@ all: hubble
hubble:
$(GO) build $(if $(GO_TAGS),-tags $(GO_TAGS)) -ldflags "-w -s -X 'github.com/cilium/hubble/pkg.GitBranch=${GIT_BRANCH}' -X 'github.com/cilium/hubble/pkg.GitHash=$(GIT_HASH)' -X 'github.com/cilium/hubble/pkg.Version=${VERSION}'" -o $(TARGET)

release:
for OS in darwin linux; do \
for ARCH in 386 amd64; do \
test -d release/$$OS/$$ARCH|| mkdir -p release/$$OS/$$ARCH; \
env GOOS=$$OS GOARCH=$$ARCH $(GO) build $(if $(GO_TAGS),-tags $(GO_TAGS)) -ldflags "-w -s -X 'github.com/cilium/hubble/pkg.Version=${VERSION}'" -o release/$$OS/$$ARCH/$(TARGET); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we extract a common variable/macro for the build flags (-tags, -w, -s, -X etc)?

tar -czf release/$(TARGET)-v$(VERSION)-$$OS-$$ARCH.tar.gz -C release/$$OS/$$ARCH $(TARGET); \
cd release && sha256sum $(TARGET)-v$(VERSION)-$$OS-$$ARCH.tar.gz > $(TARGET)-v$(VERSION)-$$OS-$$ARCH.tar.gz.sha256sum && cd $(CURDIR); \
done; \
done

install: hubble
$(INSTALL) -m 0755 -d $(DESTDIR)$(BINDIR)
$(INSTALL) -m 0755 ./hubble $(DESTDIR)$(BINDIR)

clean:
rm -f $(TARGET)
rm -rf ./release

test:
go test -timeout=$(TEST_TIMEOUT) -race -cover $$(go list ./...)
Expand Down Expand Up @@ -52,4 +63,4 @@ vet:
image:
$(CONTAINER_ENGINE) build -t $(IMAGE_REPOSITORY)$(if $(IMAGE_TAG),:$(IMAGE_TAG)) .

.PHONY: all hubble install clean test bench check check-fmt ineffassign lint vet image
.PHONY: all hubble release install clean test bench check check-fmt ineffassign lint vet image