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

Commit e3115da

Browse files
committed
Remove --output option
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 4557d51 commit e3115da

File tree

3 files changed

+15
-29
lines changed

3 files changed

+15
-29
lines changed

e2e/build_test.go

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import (
44
"encoding/json"
55
"io/ioutil"
66
"path"
7+
"strings"
78
"testing"
89

910
"github.com/deislabs/cnab-go/bundle"
1011
"gotest.tools/assert"
11-
"gotest.tools/fs"
12-
1312
"gotest.tools/icmd"
1413
)
1514

@@ -18,12 +17,20 @@ func TestBuild(t *testing.T) {
1817
cmd := info.configuredCmd
1918

2019
testDir := path.Join("testdata", "build")
21-
dir := fs.NewDir(t, "test-name")
22-
defer dir.Remove()
23-
f := dir.Join("bundle.json")
24-
cmd.Command = dockerCli.Command("app", "build", path.Join(testDir, "single"), "a-simple-tag", "--output", f)
20+
cmd.Command = dockerCli.Command("app", "build", path.Join(testDir, "single"), "single:1.0.0")
2521
icmd.RunCmd(cmd).Assert(t, icmd.Success)
2622

23+
var cfg string
24+
for _, s := range cmd.Env {
25+
if strings.HasPrefix(s, "DOCKER_CONFIG=") {
26+
cfg = s[14:]
27+
}
28+
}
29+
if cfg == "" {
30+
t.Fatalf("Failed to retrieve docker config folder")
31+
}
32+
33+
f := path.Join(cfg, "app", "bundles", "docker.io", "library", "single", "_tags", "1.0.0.json")
2734
data, err := ioutil.ReadFile(f)
2835
assert.NilError(t, err)
2936
var bndl bundle.Bundle

internal/commands/build/build.go

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"encoding/json"
77
"errors"
88
"fmt"
9-
"io/ioutil"
109
"os"
1110
"strconv"
1211
"strings"
@@ -35,7 +34,6 @@ type buildOptions struct {
3534
progress string
3635
pull bool
3736
tag string
38-
out string
3937
}
4038

4139
func Cmd(dockerCli command.Cli) *cobra.Command {
@@ -60,10 +58,6 @@ func Cmd(dockerCli command.Cli) *cobra.Command {
6058
flags.StringVar(&opts.progress, "progress", "auto", "Set type of progress output (auto, plain, tty). Use plain to show container output")
6159
flags.BoolVar(&opts.pull, "pull", false, "Always attempt to pull a newer version of the image")
6260

63-
// For diagnostic and testing only
64-
flags.StringVarP(&opts.out, "output", "o", "", "Dump generated bundle into a file")
65-
flags.MarkHidden("output") //nolint:errcheck
66-
6761
return cmd
6862
}
6963

@@ -136,7 +130,7 @@ func runBuild(dockerCli command.Cli, application string, opt buildOptions) (refe
136130
}
137131
}
138132

139-
if err = persistBundle(opt, bundle, ref); err != nil {
133+
if err = packager.PersistInBundleStore(ref, bundle); err != nil {
140134
return nil, err
141135
}
142136
return ref, nil
@@ -174,21 +168,6 @@ func updateBundle(bundle *bundle.Bundle, resp map[string]*client.SolveResponse)
174168
debugBundle(bundle)
175169
}
176170

177-
func persistBundle(opt buildOptions, bndl *bundle.Bundle, ref reference.Named) error {
178-
if opt.out != "" {
179-
b, err := json.MarshalIndent(bndl, "", " ")
180-
if err != nil {
181-
return err
182-
}
183-
if opt.out == "-" {
184-
_, err = os.Stdout.Write(b)
185-
return err
186-
}
187-
return ioutil.WriteFile(opt.out, b, 0644)
188-
}
189-
return packager.PersistInBundleStore(ref, bndl)
190-
}
191-
192171
func createInvocationImageBuildOptions(dockerCli command.Cli, app *types.App) (build.Options, error) {
193172
buildContext := bytes.NewBuffer(nil)
194173
if err := packager.PackInvocationImageContext(dockerCli, app, buildContext); err != nil {

internal/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
var (
1111
// Version is the git tag that this was built from.
12-
Version = "v0.8.0-169-gbcdf883109"
12+
Version = "unknown"
1313
// GitCommit is the commit that this was built from.
1414
GitCommit = "unknown"
1515
// BuildTime is the time at which the binary was built.

0 commit comments

Comments
 (0)