Skip to content

Commit

Permalink
DEV: move version checks to rebuild commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
featheredtoast committed May 23, 2024
1 parent b15a14c commit 0e89de1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions launcher_go/v2/cli_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"os"
"os/exec"
"runtime"
"slices"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -229,6 +230,11 @@ type RebuildCmd struct {
}

func (r *RebuildCmd) Run(cli *Cli, ctx *context.Context) error {

if slices.Contains([]string{"", "0", "false"}, os.Getenv("SKIP_VERSION_CHECK")) {
CheckVersion()
}

config, err := config.LoadConfig(cli.ConfDir, r.Config, true, cli.TemplatesDir)
if err != nil {
return errors.New("YAML syntax error. Please check your containers/*.yml config files.")
Expand Down
3 changes: 3 additions & 0 deletions launcher_go/v2/cli_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ var _ = Describe("Runtime", func() {

ctx = context.Background()

//Skip version checks for tests
os.Setenv("SKIP_VERSION_CHECK", "1")

cli = &ddocker.Cli{
ConfDir: "./test/containers",
TemplatesDir: "./test",
Expand Down
5 changes: 0 additions & 5 deletions launcher_go/v2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"os"
"os/exec"
"os/signal"
"slices"
)

type Cli struct {
Expand Down Expand Up @@ -56,10 +55,6 @@ func main() {
kongplete.WithPredictor("dir", complete.PredictDirs("*")),
)

if slices.Contains([]string{"", "0", "false"}, os.Getenv("SKIP_VERSION_CHECK")) {
CheckVersion()
}

ctx, err := parser.Parse(os.Args[1:])
parser.FatalIfErrorf(err)

Expand Down

0 comments on commit 0e89de1

Please sign in to comment.