Skip to content

Commit

Permalink
DEV: convert skip version check to CLI arg. preseve setting in env.
Browse files Browse the repository at this point in the history
  • Loading branch information
featheredtoast committed May 23, 2024
1 parent a9a40e0 commit f7f821c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions launcher_go/v2/cli_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"os"
"os/exec"
"runtime"
"slices"
"strings"
"syscall"
"time"
Expand Down Expand Up @@ -224,14 +223,15 @@ func (r *LogsCmd) Run(cli *Cli, ctx *context.Context) error {
}

type RebuildCmd struct {
Config string `arg:"" name:"config" help:"config" predictor:"config"`
FullBuild bool `name:"full-build" help:"Run a full build image even when migrate on boot and precompile on boot are present in the config. Saves a fully built image with environment baked in. Without this flag, if MIGRATE_ON_BOOT is set in config it will defer migration until container start, and if PRECOMPILE_ON_BOOT is set in the config, it will defer configure step until container start."`
Clean bool `help:"also runs clean"`
Config string `arg:"" name:"config" help:"config" predictor:"config"`
FullBuild bool `name:"full-build" help:"Run a full build image even when migrate on boot and precompile on boot are present in the config. Saves a fully built image with environment baked in. Without this flag, if MIGRATE_ON_BOOT is set in config it will defer migration until container start, and if PRECOMPILE_ON_BOOT is set in the config, it will defer configure step until container start."`
SkipVersionCheck bool `env:"SKIP_VERSION_CHECK" help:"Skips launcher checking for a new version"`
Clean bool `help:"also runs clean"`
}

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

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

Expand Down
7 changes: 2 additions & 5 deletions launcher_go/v2/cli_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ 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 Expand Up @@ -102,7 +99,7 @@ var _ = Describe("Runtime", func() {
})

It("should keep running during commits, and be post-deploy migration aware when using a web only container", func() {
runner := ddocker.RebuildCmd{Config: "web_only"}
runner := ddocker.RebuildCmd{Config: "web_only", SkipVersionCheck: true}

runner.Run(cli, &ctx)

Expand Down Expand Up @@ -146,7 +143,7 @@ var _ = Describe("Runtime", func() {
})

It("should stop with standalone", func() {
runner := ddocker.RebuildCmd{Config: "standalone"}
runner := ddocker.RebuildCmd{Config: "standalone", SkipVersionCheck: true}

runner.Run(cli, &ctx)

Expand Down

0 comments on commit f7f821c

Please sign in to comment.