cmd/version: skip server start to get the current mattermost version (#15234)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
91a76b2df9
Коммит
4e43826c5c
@@ -16,10 +16,18 @@ var VersionCmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
VersionCmd.Flags().Bool("skip-server-start", false, "Skip the server initialization and return the Mattermost version without the DB version.")
|
||||||
|
|
||||||
RootCmd.AddCommand(VersionCmd)
|
RootCmd.AddCommand(VersionCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func versionCmdF(command *cobra.Command, args []string) error {
|
func versionCmdF(command *cobra.Command, args []string) error {
|
||||||
|
skipStart, _ := command.Flags().GetBool("skip-server-start")
|
||||||
|
if skipStart {
|
||||||
|
printVersionNoDB()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
a, err := InitDBCommandContextCobra(command)
|
a, err := InitDBCommandContextCobra(command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -31,10 +39,14 @@ func versionCmdF(command *cobra.Command, args []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printVersion(a *app.App) {
|
func printVersion(a *app.App) {
|
||||||
|
printVersionNoDB()
|
||||||
|
CommandPrintln("DB Version: " + a.Srv().Store.GetCurrentSchemaVersion())
|
||||||
|
}
|
||||||
|
|
||||||
|
func printVersionNoDB() {
|
||||||
CommandPrintln("Version: " + model.CurrentVersion)
|
CommandPrintln("Version: " + model.CurrentVersion)
|
||||||
CommandPrintln("Build Number: " + model.BuildNumber)
|
CommandPrintln("Build Number: " + model.BuildNumber)
|
||||||
CommandPrintln("Build Date: " + model.BuildDate)
|
CommandPrintln("Build Date: " + model.BuildDate)
|
||||||
CommandPrintln("Build Hash: " + model.BuildHash)
|
CommandPrintln("Build Hash: " + model.BuildHash)
|
||||||
CommandPrintln("Build Enterprise Ready: " + model.BuildEnterpriseReady)
|
CommandPrintln("Build Enterprise Ready: " + model.BuildEnterpriseReady)
|
||||||
CommandPrintln("DB Version: " + a.Srv().Store.GetCurrentSchemaVersion())
|
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user