Fix version flag

This commit is contained in:
2022-02-14 17:15:11 +01:00
parent b602aa5e39
commit 722c7424d0
3 changed files with 17 additions and 10 deletions

View File

@@ -38,8 +38,8 @@ else
@echo "=> Build in container using" $(CTN) @echo "=> Build in container using" $(CTN)
@echo @echo
endif endif
ifeq ($(GO),local)
echo $(BLD_CMD) echo $(BLD_CMD)
ifeq ($(GO),local)
$(BLD_CMD) $(BLD_CMD)
else ifeq ($(CTN),podman) else ifeq ($(CTN),podman)
@podman run --rm -v $(PWD):/go/src/katenary:z -w /go/src/katenary --userns keep-id -it golang $(BLD_CMD) @podman run --rm -v $(PWD):/go/src/katenary:z -w /go/src/katenary --userns keep-id -it golang $(BLD_CMD)
@@ -48,7 +48,8 @@ else
endif endif
echo echo
echo "Check the version" echo "Check the version"
echo "'./katenary version' => $(shell ./katenary version)" echo -n "'./katenary version' => "; ./katenary version
echo
install: build install: build

View File

@@ -11,13 +11,14 @@ import (
"strings" "strings"
) )
var composeFiles = []string{"docker-compose.yaml", "docker-compose.yml"} var (
var ComposeFile = "" composeFiles = []string{"docker-compose.yaml", "docker-compose.yml"}
var AppName = "MyApp" ComposeFile = ""
var Version = "master" // set at build time to the git version/tag AppName = "MyApp"
var ChartsDir = "chart" ChartsDir = "chart"
Version = "master"
var AppVersion = "0.0.1" AppVersion = "0.0.1"
)
func init() { func init() {
FindComposeFile() FindComposeFile()

View File

@@ -7,7 +7,8 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var Version = "master" // set at build time to the git version/tag var Version = "master" // changed at compile time
var longHelp = `Katenary aims to be a tool to convert docker-compose files to Helm Charts. var longHelp = `Katenary aims to be a tool to convert docker-compose files to Helm Charts.
It will create deployments, services, volumes, secrets, and ingress resources. It will create deployments, services, volumes, secrets, and ingress resources.
But it will also create initContainers based on depend_on, healthcheck, and other features. But it will also create initContainers based on depend_on, healthcheck, and other features.
@@ -25,6 +26,10 @@ or
` `
func main() { func main() {
// set the version to "cmd" package - yes... it's ugly
cmd.Version = Version
// The base command // The base command
rootCmd := &cobra.Command{ rootCmd := &cobra.Command{
Use: "katenary", Use: "katenary",