Skip to content

Commit

Permalink
Added cli flags behind proper guards
Browse files Browse the repository at this point in the history
Signed-off-by: Domenico Luciani <[email protected]>
  • Loading branch information
Domenico Luciani committed Sep 13, 2023
1 parent ba7971e commit 61a7ea4
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
3 changes: 0 additions & 3 deletions acceptance/detector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ func TestDetector(t *testing.T) {
info, err := h.DockerCli(t).Info(context.TODO())
h.AssertNil(t, err)

// These variables are clones of the variables in analyzer_test.go.
// You can find the same variables there without `builder` prefix.
// These lines are added for supporting windows tests.
detectorDaemonOS = info.OSType
detectorDaemonArch = info.Architecture
if detectorDaemonArch == "x86_64" {
Expand Down
3 changes: 3 additions & 0 deletions acceptance/rebaser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func TestRebaser(t *testing.T) {
func testRebaser(platformAPI string) func(t *testing.T, when spec.G, it spec.S) {
return func(t *testing.T, when spec.G, it spec.S) {
when("called with insecure registry flag", func() {
it.Before(func() {
h.SkipIf(t, api.MustParse(platformAPI).LessThan("0.12"), "")
})
it("should do an http request", func() {
insecureRegistry := "host.docker.internal"
rebaserOutputImageName := insecureRegistry + "/bar"
Expand Down
2 changes: 1 addition & 1 deletion cmd/lifecycle/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ func (a *analyzeCmd) DefineFlags() {
cli.FlagLayoutDir(&a.LayoutDir)
cli.FlagUseLayout(&a.UseLayout)
cli.FlagRunPath(&a.RunPath)
cli.FlagInsecureRegistries(&a.InsecureRegistries)
fallthrough
case a.PlatformAPI.AtLeast("0.9"):
cli.FlagLaunchCacheDir(&a.LaunchCacheDir)
Expand All @@ -58,7 +59,6 @@ func (a *analyzeCmd) DefineFlags() {
cli.FlagUID(&a.UID)
cli.FlagUseDaemon(&a.UseDaemon)
}
cli.FlagInsecureRegistries(&a.InsecureRegistries)
}

// Args validates arguments and flags, and fills in default values.
Expand Down
2 changes: 1 addition & 1 deletion cmd/lifecycle/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (c *createCmd) DefineFlags() {
cli.FlagLayoutDir(&c.LayoutDir)
cli.FlagUseLayout(&c.UseLayout)
cli.FlagRunPath(&c.RunPath)
cli.FlagInsecureRegistries(&c.InsecureRegistries)
}
if c.PlatformAPI.AtLeast("0.11") {
cli.FlagBuildConfigDir(&c.BuildConfigDir)
Expand All @@ -59,7 +60,6 @@ func (c *createCmd) DefineFlags() {
cli.FlagTags(&c.AdditionalTags)
cli.FlagUID(&c.UID)
cli.FlagUseDaemon(&c.UseDaemon)
cli.FlagInsecureRegistries(&c.InsecureRegistries)
}

// Args validates arguments and flags, and fills in default values.
Expand Down
2 changes: 1 addition & 1 deletion cmd/lifecycle/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func (e *exportCmd) DefineFlags() {
cli.FlagLayoutDir(&e.LayoutDir)
cli.FlagRunPath(&e.RunPath)
cli.FlagUseLayout(&e.UseLayout)
cli.FlagInsecureRegistries(&e.InsecureRegistries)
} else {
cli.FlagStackPath(&e.StackPath)
}
Expand All @@ -76,7 +77,6 @@ func (e *exportCmd) DefineFlags() {
cli.FlagRunImage(&e.RunImageRef) // FIXME: this flag isn't valid on Platform 0.7 and later
cli.FlagUID(&e.UID)
cli.FlagUseDaemon(&e.UseDaemon)
cli.FlagInsecureRegistries(&e.InsecureRegistries)

cli.DeprecatedFlagRunImage(&e.DeprecatedRunImageRef) // FIXME: this flag isn't valid on Platform 0.7 and later
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lifecycle/rebaser.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ func (r *rebaseCmd) DefineFlags() {
cli.FlagUID(&r.UID)
cli.FlagUseDaemon(&r.UseDaemon)
cli.DeprecatedFlagRunImage(&r.DeprecatedRunImageRef)
cli.FlagInsecureRegistries(&r.InsecureRegistries)

if r.PlatformAPI.AtLeast("0.11") {
cli.FlagPreviousImage(&r.PreviousImageRef)
}

if r.PlatformAPI.AtLeast("0.12") {
cli.FlagForceRebase(&r.ForceRebase)
cli.FlagInsecureRegistries(&r.InsecureRegistries)
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/lifecycle/restorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (r *restoreCmd) DefineFlags() {
cli.FlagGeneratedDir(&r.GeneratedDir)
cli.FlagUseLayout(&r.UseLayout)
cli.FlagLayoutDir(&r.LayoutDir)
cli.FlagInsecureRegistries(&r.InsecureRegistries)
}
if r.PlatformAPI.AtLeast("0.10") {
cli.FlagBuildImage(&r.BuildImageRef)
Expand All @@ -57,7 +58,6 @@ func (r *restoreCmd) DefineFlags() {
cli.FlagGroupPath(&r.GroupPath)
cli.FlagLayersDir(&r.LayersDir)
cli.FlagUID(&r.UID)
cli.FlagInsecureRegistries(&r.InsecureRegistries)
}

// Args validates arguments and flags, and fills in default values.
Expand Down

0 comments on commit 61a7ea4

Please sign in to comment.