From b5edfdc2d4c9e5ea9dc78d7401a174d8cc16d43f Mon Sep 17 00:00:00 2001 From: Kazuyoshi Kato Date: Thu, 9 Jan 2020 10:54:40 -0800 Subject: [PATCH] Fill out containerd's Revision variable correctly As like containerd's Makefile, we can fill out version.Revision to make our life easier. https://github.com/containerd/containerd/blob/0a1f2b40642e54ed06cd0a22cdf6025cbe70853c/Makefile#L24 Signed-off-by: Kazuyoshi Kato --- firecracker-control/cmd/containerd/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/firecracker-control/cmd/containerd/Makefile b/firecracker-control/cmd/containerd/Makefile index 9b2d88577..1b186ddaf 100644 --- a/firecracker-control/cmd/containerd/Makefile +++ b/firecracker-control/cmd/containerd/Makefile @@ -17,16 +17,20 @@ EXTRAGOARGS:= SRC := $(shell find . -name '*.go') GOMOD := $(shell go env GOMOD) GOSUM := $(GOMOD:.mod=.sum) +REVISION=$(shell git rev-parse HEAD) +VERSION_LDFLAGS="-X github.com/containerd/containerd/version.Revision=$(REVISION)" all: build build: firecracker-containerd firecracker-ctr firecracker-containerd: $(SRC) $(GOMOD) $(GOSUM) - go build $(EXTRAGOARGS) -o firecracker-containerd + go build $(EXTRAGOARGS) \ + -ldflags $(VERSION_LDFLAGS) -o firecracker-containerd firecracker-ctr: $(GOMOD) $(GOSUM) - GOBIN=$(CURDIR) go install -tags=no_cri $(EXTRAGOARGS) github.com/containerd/containerd/cmd/ctr + GOBIN=$(CURDIR) go install -tags=no_cri $(EXTRAGOARGS) \ + -ldflags $(VERSION_LDFLAGS) github.com/containerd/containerd/cmd/ctr mv ctr firecracker-ctr install: firecracker-containerd firecracker-ctr