Skip to content

Commit 8f34147

Browse files
committed
alpha: errors with stack, private svc support
1 parent b31b07c commit 8f34147

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+735
-358
lines changed

cmd/deploy.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package cmd
22

33
import (
4-
"fmt"
54
"strings"
65

6+
"github.com/ansel1/merry/v2"
77
"github.com/outblocks/outblocks-cli/pkg/actions"
88
"github.com/outblocks/outblocks-cli/pkg/config"
99
"github.com/spf13/cobra"
@@ -28,17 +28,17 @@ func (e *Executor) newDeployCmd() *cobra.Command {
2828
}
2929

3030
if len(opts.TargetApps) > 0 && len(opts.SkipApps) > 0 {
31-
return fmt.Errorf("target-apps and skip-apps arguments are mutually exclusive modes")
31+
return merry.New("target-apps and skip-apps arguments are mutually exclusive modes")
3232
}
3333

3434
if opts.SkipAllApps && opts.Destroy {
35-
return fmt.Errorf("skip-all-apps and destroy areare mutually exclusive modes")
35+
return merry.New("skip-all-apps and destroy areare mutually exclusive modes")
3636
}
3737

3838
for _, t := range targetApps {
3939
tsplit := strings.SplitN(t, ".", 2)
4040
if len(tsplit) != 2 {
41-
return fmt.Errorf("wrong format for target '%s': specify in a form of <app type>.<name>, e.g.: static.website", t)
41+
return merry.Errorf("wrong format for target '%s': specify in a form of <app type>.<name>, e.g.: static.website", t)
4242
}
4343

4444
opts.TargetApps = append(opts.TargetApps, config.ComputeAppID(tsplit[0], tsplit[1]))
@@ -48,7 +48,7 @@ func (e *Executor) newDeployCmd() *cobra.Command {
4848
for _, t := range skipApps {
4949
tsplit := strings.SplitN(t, ".", 2)
5050
if len(tsplit) != 2 {
51-
return fmt.Errorf("wrong format for skip '%s': specify in a form of <app type>.<name>, e.g.: static.website", t)
51+
return merry.Errorf("wrong format for skip '%s': specify in a form of <app type>.<name>, e.g.: static.website", t)
5252
}
5353

5454
opts.SkipApps = append(opts.SkipApps, config.ComputeAppID(tsplit[0], tsplit[1]))

cmd/executor.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package cmd
33
import (
44
"context"
55
"errors"
6-
"fmt"
76
"os"
87
"path/filepath"
98
"strings"
109

10+
"github.com/ansel1/merry/v2"
1111
"github.com/goccy/go-yaml"
1212
"github.com/outblocks/outblocks-cli/internal/fileutil"
1313
"github.com/outblocks/outblocks-cli/pkg/cli"
@@ -96,12 +96,12 @@ func (e *Executor) commandPreRun(ctx context.Context) error {
9696

9797
pwd, err := os.Getwd()
9898
if err != nil {
99-
return fmt.Errorf("cannot find current directory: %w", err)
99+
return merry.Errorf("cannot find current directory: %w", err)
100100
}
101101

102102
pwd, err = filepath.EvalSymlinks(pwd)
103103
if err != nil {
104-
return fmt.Errorf("cannot evaluate current directory: %w", err)
104+
return merry.Errorf("cannot evaluate current directory: %w", err)
105105
}
106106

107107
cfgPath := fileutil.FindYAMLGoingUp(pwd, config.ProjectYAMLName)
@@ -112,10 +112,13 @@ func (e *Executor) commandPreRun(ctx context.Context) error {
112112
return nil
113113
}
114114

115-
return fmt.Errorf("cannot load values files: %w", err)
115+
return merry.Errorf("cannot load values files: %w", err)
116116
}
117117

118-
vals := map[string]interface{}{"var": v}
118+
vals := map[string]interface{}{
119+
"var": v,
120+
"env": e.opts.env,
121+
}
119122

120123
// Load config file.
121124
if err := e.loadProjectConfig(ctx, cfgPath, e.srv.Addr().String(), vals, skipLoadApps, skipLoadPlugins, skipCheckConfig); err != nil && !errors.Is(err, config.ErrProjectConfigNotFound) {
@@ -148,7 +151,7 @@ func (e *Executor) addPluginsCommands(cmd *cobra.Command) error {
148151
arg.Name = strings.ToLower(arg.Name)
149152

150153
if flags.Lookup(arg.Name) != nil {
151-
return fmt.Errorf("plugin tried to add already existing argument '%s' to command '%s'", arg, cmdName)
154+
return merry.Errorf("plugin tried to add already existing argument '%s' to command '%s'", arg, cmdName)
152155
}
153156

154157
switch arg.Type {

cmd/executor_config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package cmd
22

33
import (
44
"context"
5-
"fmt"
65
"path/filepath"
76

7+
"github.com/ansel1/merry/v2"
88
"github.com/goccy/go-yaml"
9+
"github.com/outblocks/outblocks-cli/internal/fileutil"
910
"github.com/outblocks/outblocks-cli/pkg/config"
1011
"github.com/outblocks/outblocks-cli/pkg/plugins"
11-
plugin_util "github.com/outblocks/outblocks-plugin-go/util"
1212
)
1313

1414
func (e *Executor) loadProjectConfig(ctx context.Context, cfgPath, hostAddr string, vals map[string]interface{}, skipLoadApps, skipLoadPlugins, skipCheck bool) error {
@@ -53,7 +53,7 @@ func (e *Executor) cleanupProject() error {
5353
if e.cfg != nil {
5454
for _, plug := range e.cfg.LoadedPlugins() {
5555
if err := plug.Stop(); err != nil {
56-
return fmt.Errorf("error stopping plugin '%s': %w", plug.Name, err)
56+
return merry.Errorf("error stopping plugin '%s': %w", plug.Name, err)
5757
}
5858
}
5959
}
@@ -70,11 +70,11 @@ func (e *Executor) saveLockfile() error {
7070

7171
data, err := yaml.MarshalWithOptions(lock, yaml.UseJSONMarshaler())
7272
if err != nil {
73-
return fmt.Errorf("marshaling lockfile error: %w", err)
73+
return merry.Errorf("marshaling lockfile error: %w", err)
7474
}
7575

76-
if err := plugin_util.WriteFile(filepath.Join(e.cfg.Dir, config.LockfileName), data, 0755); err != nil {
77-
return fmt.Errorf("writing lockfile error: %w", err)
76+
if err := fileutil.WriteFile(filepath.Join(e.cfg.Dir, config.LockfileName), data, 0755); err != nil {
77+
return merry.Errorf("writing lockfile error: %w", err)
7878
}
7979

8080
return nil

go.mod

Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,89 +7,105 @@ require (
77
github.com/Masterminds/semver v1.5.0
88
github.com/Masterminds/sprig v2.22.0+incompatible
99
github.com/Masterminds/vcs v1.13.1
10-
github.com/docker/docker v20.10.10+incompatible
10+
github.com/ansel1/merry/v2 v2.0.0-beta.12
11+
github.com/docker/docker v20.10.12+incompatible
1112
github.com/enescakir/emoji v1.0.0
1213
github.com/go-ozzo/ozzo-validation/v4 v4.3.0
13-
github.com/goccy/go-yaml v1.8.9
14+
github.com/goccy/go-yaml v1.9.4
1415
github.com/google/go-github/v35 v35.3.0
15-
github.com/gookit/color v1.4.2
16+
github.com/gookit/color v1.5.0
1617
github.com/mholt/archiver/v3 v3.5.1
1718
github.com/mitchellh/go-homedir v1.1.0
18-
github.com/otiai10/copy v1.6.0
19-
github.com/outblocks/outblocks-plugin-go v0.0.0-20211216161637-f1d776328c52
19+
github.com/otiai10/copy v1.7.0
20+
github.com/outblocks/outblocks-plugin-go v0.0.0-20211231145933-5721bffaa273
2021
github.com/pterm/pterm v0.12.33
21-
github.com/spf13/cobra v1.2.1
22+
github.com/spf13/cobra v1.3.0
2223
github.com/spf13/pflag v1.0.5
23-
github.com/spf13/viper v1.9.0
24+
github.com/spf13/viper v1.10.1
2425
github.com/txn2/txeh v1.3.0
2526
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
2627
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
27-
google.golang.org/grpc v1.42.0
28+
google.golang.org/grpc v1.43.0
2829
google.golang.org/protobuf v1.27.1
2930
)
3031

3132
require (
33+
cloud.google.com/go v0.99.0 // indirect
34+
cloud.google.com/go/storage v1.18.2 // indirect
3235
github.com/Masterminds/goutils v1.1.1 // indirect
33-
github.com/Microsoft/go-winio v0.4.17 // indirect
34-
github.com/andybalholm/brotli v1.0.1 // indirect
36+
github.com/Microsoft/go-winio v0.5.1 // indirect
37+
github.com/andybalholm/brotli v1.0.4 // indirect
3538
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
3639
github.com/atomicgo/cursor v0.0.1 // indirect
37-
github.com/containerd/containerd v1.5.5 // indirect
40+
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
41+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
42+
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
43+
github.com/cncf/xds/go v0.0.0-20211216145620-d92e9ce0af51 // indirect
44+
github.com/containerd/containerd v1.5.8 // indirect
3845
github.com/creasty/defaults v1.5.2 // indirect
3946
github.com/docker/distribution v2.7.1+incompatible // indirect
4047
github.com/docker/go-connections v0.4.0 // indirect
4148
github.com/docker/go-units v0.4.0 // indirect
4249
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
43-
github.com/fatih/color v1.10.0 // indirect
50+
github.com/envoyproxy/go-control-plane v0.10.1 // indirect
51+
github.com/envoyproxy/protoc-gen-validate v0.6.2 // indirect
52+
github.com/fatih/color v1.13.0 // indirect
4453
github.com/fsnotify/fsnotify v1.5.1 // indirect
45-
github.com/go-playground/validator/v10 v10.6.1 // indirect
54+
github.com/go-playground/validator/v10 v10.9.0 // indirect
4655
github.com/gogo/protobuf v1.3.2 // indirect
56+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4757
github.com/golang/protobuf v1.5.2 // indirect
48-
github.com/golang/snappy v0.0.3 // indirect
49-
github.com/google/go-querystring v1.0.0 // indirect
58+
github.com/golang/snappy v0.0.4 // indirect
59+
github.com/google/go-cmp v0.5.6 // indirect
60+
github.com/google/go-querystring v1.1.0 // indirect
5061
github.com/google/uuid v1.3.0 // indirect
62+
github.com/googleapis/gax-go/v2 v2.1.1 // indirect
63+
github.com/googleapis/google-cloud-go-testing v0.0.0-20210719221736-1c9a4c676720 // indirect
5164
github.com/gorilla/mux v1.8.0 // indirect
5265
github.com/hashicorp/hcl v1.0.0 // indirect
5366
github.com/huandu/xstrings v1.3.2 // indirect
5467
github.com/imdario/mergo v0.3.12 // indirect
5568
github.com/inconshreveable/mousetrap v1.0.0 // indirect
5669
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
57-
github.com/klauspost/compress v1.11.13 // indirect
70+
github.com/klauspost/compress v1.13.6 // indirect
5871
github.com/klauspost/pgzip v1.2.5 // indirect
5972
github.com/magiconair/properties v1.8.5 // indirect
60-
github.com/mattn/go-colorable v0.1.8 // indirect
61-
github.com/mattn/go-isatty v0.0.12 // indirect
73+
github.com/mattn/go-colorable v0.1.12 // indirect
74+
github.com/mattn/go-isatty v0.0.14 // indirect
6275
github.com/mattn/go-runewidth v0.0.13 // indirect
63-
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
76+
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
6477
github.com/mitchellh/copystructure v1.2.0 // indirect
65-
github.com/mitchellh/mapstructure v1.4.2 // indirect
78+
github.com/mitchellh/mapstructure v1.4.3 // indirect
6679
github.com/mitchellh/reflectwalk v1.0.2 // indirect
6780
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
6881
github.com/morikuni/aec v1.0.0 // indirect
69-
github.com/nwaples/rardecode v1.1.0 // indirect
82+
github.com/nwaples/rardecode v1.1.2 // indirect
7083
github.com/opencontainers/go-digest v1.0.0 // indirect
71-
github.com/opencontainers/image-spec v1.0.1 // indirect
84+
github.com/opencontainers/image-spec v1.0.2 // indirect
7285
github.com/pelletier/go-toml v1.9.4 // indirect
73-
github.com/pierrec/lz4/v4 v4.1.2 // indirect
86+
github.com/pierrec/lz4/v4 v4.1.12 // indirect
7487
github.com/pkg/errors v0.9.1 // indirect
7588
github.com/rivo/uniseg v0.2.0 // indirect
7689
github.com/sirupsen/logrus v1.8.1 // indirect
77-
github.com/spf13/afero v1.6.0 // indirect
90+
github.com/spf13/afero v1.7.0 // indirect
7891
github.com/spf13/cast v1.4.1 // indirect
7992
github.com/spf13/jwalterweatherman v1.1.0 // indirect
8093
github.com/subosito/gotenv v1.2.0 // indirect
81-
github.com/ulikunitz/xz v0.5.9 // indirect
94+
github.com/ulikunitz/xz v0.5.10 // indirect
8295
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
8396
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
84-
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
85-
golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420 // indirect
97+
go.opencensus.io v0.23.0 // indirect
98+
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
99+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
86100
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
87-
golang.org/x/sys v0.0.0-20211013075003-97ac67df715c // indirect
88-
golang.org/x/text v0.3.6 // indirect
101+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
102+
golang.org/x/text v0.3.7 // indirect
89103
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
104+
google.golang.org/api v0.63.0 // indirect
90105
google.golang.org/appengine v1.6.7 // indirect
91-
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 // indirect
92-
gopkg.in/ini.v1 v1.63.2 // indirect
106+
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect
107+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
108+
gopkg.in/ini.v1 v1.66.2 // indirect
93109
gopkg.in/yaml.v2 v2.4.0 // indirect
94110
)
95111

0 commit comments

Comments
 (0)