Add version command and fix commit version

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka
2023-02-16 15:43:33 +01:00
parent bc53b0de3a
commit 91d6fa6945
4 changed files with 23 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ import (
"os"
"github.com/kairos-io/immucore/internal/utils"
"github.com/kairos-io/immucore/internal/version"
"github.com/kairos-io/immucore/pkg/mount"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
@@ -39,6 +40,9 @@ Sends a generic event payload with the configuration found in the scanned direct
zerolog.SetGlobalLevel(zerolog.DebugLevel)
}
v := version.Get()
log.Logger.Info().Str("commit", v.GitCommit).Str("compiled with", v.GoVersion).Str("version", v.Version).Msg("Immucore")
g := herd.DAG(herd.EnableInit)
// You can pass rd.cos.disable in the cmdline to disable the whole immutable stuff
@@ -86,4 +90,15 @@ Sends a generic event payload with the configuration found in the scanned direct
return err
},
},
{
Name: "version",
Usage: "version",
Action: func(c *cli.Context) error {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Logger()
zerolog.SetGlobalLevel(zerolog.InfoLevel)
v := version.Get()
log.Logger.Info().Str("commit", v.GitCommit).Str("compiled with", v.GoVersion).Str("version", v.Version).Msg("Immucore")
return nil
},
},
}