Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit c046cee

Browse files
authored
Merge pull request #33 from mnottale/experimental
Add experimental build flag. Only leave out init, inspect, helm and render
2 parents f2a9455 + 6dac468 commit c046cee

File tree

12 files changed

+60
-20
lines changed

12 files changed

+60
-20
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
PKG_NAME := github.com/docker/lunchbox
22
BIN_NAME := docker-app
33

4+
# Enable experimental features. "on" or "off"
5+
EXPERIMENTAL := off
6+
47
TAG ?= $(shell git describe --always --dirty)
58
COMMIT ?= $(shell git rev-parse --short HEAD)
69

@@ -18,7 +21,8 @@ IMAGE_BUILD_ARGS := \
1821

1922
LDFLAGS := "-s -w \
2023
-X $(PKG_NAME)/internal.GitCommit=$(COMMIT) \
21-
-X $(PKG_NAME)/internal.Version=$(TAG)"
24+
-X $(PKG_NAME)/internal.Version=$(TAG) \
25+
-X $(PKG_NAME)/internal.Experimental=$(EXPERIMENTAL)"
2226

2327
#####################
2428
# Local Development #

cmd/build.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/docker/lunchbox/internal"
67
"github.com/spf13/cobra"
78
)
89

@@ -16,5 +17,7 @@ var buildCmd = &cobra.Command{
1617
}
1718

1819
func init() {
19-
rootCmd.AddCommand(buildCmd)
20+
if internal.Experimental == "on" {
21+
rootCmd.AddCommand(buildCmd)
22+
}
2023
}

cmd/deploy.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"fmt"
55

6+
"github.com/docker/lunchbox/internal"
67
"github.com/spf13/cobra"
78
)
89

@@ -16,7 +17,9 @@ var deployCmd = &cobra.Command{
1617
}
1718

1819
func init() {
19-
rootCmd.AddCommand(deployCmd)
20+
if internal.Experimental == "on" {
21+
rootCmd.AddCommand(deployCmd)
22+
}
2023

2124
// Here you will define your flags and configuration settings.
2225

cmd/image-add.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"strings"
77

88
"github.com/docker/lunchbox/image"
9+
"github.com/docker/lunchbox/internal"
910
"github.com/spf13/cobra"
1011
)
1112

@@ -35,8 +36,10 @@ var imageAddSettingsFile []string
3536
var imageAddEnv []string
3637

3738
func init() {
38-
rootCmd.AddCommand(imageAddCmd)
39-
imageAddCmd.Flags().StringArrayVarP(&imageAddComposeFiles, "compose-files", "c", []string{}, "Override Compose files")
40-
imageAddCmd.Flags().StringArrayVarP(&imageAddSettingsFile, "settings-files", "s", []string{}, "Override settings files")
41-
imageAddCmd.Flags().StringArrayVarP(&imageAddEnv, "env", "e", []string{}, "Override environment values")
39+
if internal.Experimental == "on" {
40+
rootCmd.AddCommand(imageAddCmd)
41+
imageAddCmd.Flags().StringArrayVarP(&imageAddComposeFiles, "compose-files", "c", []string{}, "Override Compose files")
42+
imageAddCmd.Flags().StringArrayVarP(&imageAddSettingsFile, "settings-files", "s", []string{}, "Override settings files")
43+
imageAddCmd.Flags().StringArrayVarP(&imageAddEnv, "env", "e", []string{}, "Override environment values")
44+
}
4245
}

cmd/image-load.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66

77
"github.com/docker/lunchbox/image"
8+
"github.com/docker/lunchbox/internal"
89
"github.com/spf13/cobra"
910
)
1011

@@ -22,5 +23,7 @@ var imageLoadCmd = &cobra.Command{
2223
}
2324

2425
func init() {
25-
rootCmd.AddCommand(imageLoadCmd)
26+
if internal.Experimental == "on" {
27+
rootCmd.AddCommand(imageLoadCmd)
28+
}
2629
}

cmd/load.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/docker/lunchbox/internal"
78
"github.com/docker/lunchbox/packager"
89
"github.com/spf13/cobra"
910
)
@@ -22,5 +23,7 @@ var loadCmd = &cobra.Command{
2223
}
2324

2425
func init() {
25-
rootCmd.AddCommand(loadCmd)
26+
if internal.Experimental == "on" {
27+
rootCmd.AddCommand(loadCmd)
28+
}
2629
}

cmd/pack.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/docker/lunchbox/internal"
78
"github.com/docker/lunchbox/packager"
89
"github.com/spf13/cobra"
910
)
@@ -24,6 +25,8 @@ var packCmd = &cobra.Command{
2425
var packOutputFile string
2526

2627
func init() {
27-
rootCmd.AddCommand(packCmd)
28-
packCmd.Flags().StringVarP(&packOutputFile, "output", "o", "-", "Output file (- for stdout)")
28+
if internal.Experimental == "on" {
29+
rootCmd.AddCommand(packCmd)
30+
packCmd.Flags().StringVarP(&packOutputFile, "output", "o", "-", "Output file (- for stdout)")
31+
}
2932
}

cmd/pull.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/docker/lunchbox/internal"
78
"github.com/docker/lunchbox/packager"
89
"github.com/spf13/cobra"
910
)
@@ -22,5 +23,7 @@ var pullCmd = &cobra.Command{
2223
}
2324

2425
func init() {
25-
rootCmd.AddCommand(pullCmd)
26+
if internal.Experimental == "on" {
27+
rootCmd.AddCommand(pullCmd)
28+
}
2629
}

cmd/push.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/docker/lunchbox/internal"
78
"github.com/docker/lunchbox/packager"
89
"github.com/spf13/cobra"
910
)
@@ -30,7 +31,9 @@ var (
3031
)
3132

3233
func init() {
33-
rootCmd.AddCommand(pushCmd)
34-
pushCmd.Flags().StringVarP(&pushPrefix, "prefix", "p", "", "prefix to use")
35-
pushCmd.Flags().StringVarP(&pushTag, "tag", "t", "latest", "tag to use")
34+
if internal.Experimental == "on" {
35+
rootCmd.AddCommand(pushCmd)
36+
pushCmd.Flags().StringVarP(&pushPrefix, "prefix", "p", "", "prefix to use")
37+
pushCmd.Flags().StringVarP(&pushTag, "tag", "t", "latest", "tag to use")
38+
}
3639
}

cmd/save.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"os"
66

7+
"github.com/docker/lunchbox/internal"
78
"github.com/docker/lunchbox/packager"
89
"github.com/spf13/cobra"
910
)
@@ -30,7 +31,9 @@ var (
3031
)
3132

3233
func init() {
33-
rootCmd.AddCommand(saveCmd)
34-
saveCmd.Flags().StringVarP(&savePrefix, "prefix", "p", "", "prefix to use")
35-
saveCmd.Flags().StringVarP(&saveTag, "tag", "t", "latest", "tag to use")
34+
if internal.Experimental == "on" {
35+
rootCmd.AddCommand(saveCmd)
36+
saveCmd.Flags().StringVarP(&savePrefix, "prefix", "p", "", "prefix to use")
37+
saveCmd.Flags().StringVarP(&saveTag, "tag", "t", "latest", "tag to use")
38+
}
3639
}

0 commit comments

Comments
 (0)