Skip to content

Commit 91a11eb

Browse files
author
Neil Jerram
committed
Fix calico-typha --version
LDFLAGS was defined before the other variables that it depends on.
1 parent aecac12 commit 91a11eb

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Makefile

+11-11
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ GO_BUILD_VER?=v0.16
5757
# we do not need to use the arch since go-build:v0.15 now is multi-arch manifest
5858
CALICO_BUILD=calico/go-build:$(GO_BUILD_VER)
5959

60+
# Figure out version information. To support builds from release tarballs, we default to
61+
# <unknown> if this isn't a git checkout.
62+
GIT_COMMIT:=$(shell git rev-parse HEAD || echo '<unknown>')
63+
BUILD_ID:=$(shell git rev-parse HEAD || uuidgen | sed 's/-//g')
64+
GIT_DESCRIPTION:=$(shell git describe --tags || echo '<unknown>')
65+
66+
# Calculate a timestamp for any build artefacts.
67+
DATE:=$(shell date -u +'%FT%T%z')
68+
6069
# Linker flags for building Typha.
6170
#
6271
# We use -X to insert the version information into the placeholder variables
@@ -70,15 +79,6 @@ LDFLAGS:=-ldflags "\
7079
-X $(PACKAGE_NAME)/pkg/buildinfo.GitRevision=$(GIT_COMMIT) \
7180
-B 0x$(BUILD_ID)"
7281

73-
# Figure out version information. To support builds from release tarballs, we default to
74-
# <unknown> if this isn't a git checkout.
75-
GIT_COMMIT:=$(shell git rev-parse HEAD || echo '<unknown>')
76-
BUILD_ID:=$(shell git rev-parse HEAD || uuidgen | sed 's/-//g')
77-
GIT_DESCRIPTION:=$(shell git describe --tags || echo '<unknown>')
78-
79-
# Calculate a timestamp for any build artefacts.
80-
DATE:=$(shell date -u +'%FT%T%z')
81-
8282
# List of Go files that are generated by the build process. Builds should
8383
# depend on these, clean removes them.
8484
GENERATED_GO_FILES:=
@@ -231,7 +231,7 @@ sub-push-%:
231231
tag-images: imagetag
232232
docker tag $(CONTAINER_NAME):latest-$(ARCH) $(CONTAINER_NAME):$(IMAGETAG)-$(ARCH)
233233
docker tag $(CONTAINER_NAME):latest-$(ARCH) quay.io/$(CONTAINER_NAME):$(IMAGETAG)-$(ARCH)
234-
234+
235235
# Tag images for gcr.io, used by GKE.
236236
docker tag $(CONTAINER_NAME):latest-$(ARCH) gcr.io/projectcalico-org/$(CONTAINER_NAME):$(IMAGETAG)
237237
docker tag $(CONTAINER_NAME):latest-$(ARCH) eu.gcr.io/projectcalico-org/$(CONTAINER_NAME):$(IMAGETAG)
@@ -485,4 +485,4 @@ help:
485485
@echo "ARCH (target): $(ARCH)"
486486
@echo "BUILDARCH (host): $(BUILDARCH)"
487487
@echo "CALICO_BUILD: $(CALICO_BUILD)"
488-
@echo "-----------------------------------------"
488+
@echo "-----------------------------------------"

0 commit comments

Comments
 (0)