Skip to content

Commit 8caa01d

Browse files
committed
feat(nodeadm): support for nodeadm version display
1 parent c97f6f4 commit 8caa01d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

nodeadm/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ else
55
GOBIN=$(shell go env GOBIN)
66
endif
77

8+
# Version from git tags
9+
VERSION ?= 0.0.0
10+
LDFLAGS ?= -X 'main.version=$(VERSION)'
11+
812
# Setting SHELL to bash allows bash commands to be executed by recipes.
913
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
1014
SHELL = /usr/bin/env bash -o pipefail
@@ -78,7 +82,7 @@ test-e2e: build ## Run e2e tests.
7882

7983
.PHONY: build
8084
build: ## Build binary.
81-
GOOS=$(GOOS) go build -o $(LOCALBIN)/ ./cmd/...
85+
GOOS=$(GOOS) go build -ldflags="$(LDFLAGS)" -o $(LOCALBIN)/ ./cmd/...
8286

8387
.PHONY: run
8488
run: build ## Run binary.

nodeadm/cmd/nodeadm/main.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ import (
99
"github.com/awslabs/amazon-eks-ami/nodeadm/internal/cli"
1010
)
1111

12+
var (
13+
version = "0.0.0"
14+
)
15+
1216
func main() {
1317
flaggy.SetName("nodeadm")
1418
flaggy.SetDescription("From zero to Node faster than you can say Elastic Kubernetes Service")
19+
flaggy.SetVersion(version)
1520
flaggy.DefaultParser.AdditionalHelpPrepend = "\nhttp://github.com/awslabs/amazon-eks-ami/nodeadm"
1621
flaggy.DefaultParser.ShowHelpOnUnexpected = true
1722

0 commit comments

Comments
 (0)