Commit cbc6008c authored by lukasburgey's avatar lukasburgey
Browse files

Add more version information on every build

parent 45692f35
Pipeline #85109 passed with stages
in 1 minute and 20 seconds
......@@ -2,6 +2,9 @@ PROJECT_NAME := "feudalClient"
PKG := "git.scc.kit.edu/feudal/$(PROJECT_NAME)"
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/ | grep -v _test.go)
VERSION := $(shell git describe --tags)
SCRIPT_VERSION := $(shell cat go.mod | grep feudalScripts | awk '{print $$2}')
LDFLAGS := "-X 'main.version=$(VERSION)' -X 'main.scriptsVersion=$(SCRIPT_VERSION)'"
.PHONY: all dep build clean test lint
......@@ -18,12 +21,12 @@ test: ## Run unittests
@go test -short ${PKG_LIST}
# link dynamically
build: dep ## Build the binary file
@go build -i -v $(PKG)
build: dep go.mod ## Build the binary file
go build -i -v -ldflags=$(LDFLAGS) $(PKG)
# link statically
build-static: dep ## Build the binary file
@CGO_ENABLED=0 GOOS=linux go build -v -ldflags '-extldflags "-static"' $(PKG)
build-static: dep go.mod ## Build the binary file
@CGO_ENABLED=0 GOOS=linux go build -v -ldflags='$(LDFLAGS) -extldflags -static' $(PKG)
clean: ## Remove previous build
@rm -f $(PROJECT_NAME)
......
......@@ -20,14 +20,17 @@ import (
)
var (
// version and scriptsVersion are set via: go build -ldflags '-X main.version=foobar -X main.scriptsVersion=foobar
version = ""
scriptsVersion = ""
app = kingpin.New(
"FEUDAL Client",
"Client for the Federated User Credential Deployment Portal (FEUDAL)",
).Author(
"Lukas Burgey",
).Version(
"v2.3.0",
)
).Version(fmt.Sprintf("feudalClient: %s\nfeudalScripts: %s", version, scriptsVersion))
cmdStart = app.Command("start", "Starts the client in its normal operation mode.").Default()
cmdDeregister = app.Command("deregister", "Before disabling the client: Use deregister to inform the backend that the client ceases operation.")
cmdSchema = app.Command("schema", "Can be used to generate a JSON schema (Draft 4, see json-schema.org) for the validation of script inputs, outputs and the config of this client.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment