diff --git a/cmd/executor/cmd/root.go b/cmd/executor/cmd/root.go index 97511e092..e5e0f8647 100644 --- a/cmd/executor/cmd/root.go +++ b/cmd/executor/cmd/root.go @@ -17,6 +17,7 @@ limitations under the License. package cmd import ( + "fmt" "os" "path/filepath" "strings" @@ -59,21 +60,23 @@ var RootCmd = &cobra.Command{ } return resolveDockerfilePath() }, - RunE: func(cmd *cobra.Command, args []string) error { + Run: func(cmd *cobra.Command, args []string) { if !checkContained() { if !force { - return errors.New("kaniko should only be run inside of a container, run with the --force flag if you are sure you want to continue") + exit(errors.New("kaniko should only be run inside of a container, run with the --force flag if you are sure you want to continue")) } logrus.Warn("kaniko is being run outside of a container. This can have dangerous effects on your system") } if err := os.Chdir("/"); err != nil { - return errors.Wrap(err, "error changing to root dir") + exit(errors.Wrap(err, "error changing to root dir")) } image, err := executor.DoBuild(opts) if err != nil { - return errors.Wrap(err, "error building image") + exit(errors.Wrap(err, "error building image")) + } + if err := executor.DoPush(image, opts); err != nil { + exit(errors.Wrap(err, "error pushing image")) } - return executor.DoPush(image, opts) }, } @@ -158,3 +161,8 @@ func resolveSourceContext() error { logrus.Debugf("Build context located at %s", opts.SrcContext) return nil } + +func exit(err error) { + fmt.Println(err) + os.Exit(1) +} diff --git a/pkg/config/args.go b/pkg/config/args.go index ae45b266c..44ac074e3 100644 --- a/pkg/config/args.go +++ b/pkg/config/args.go @@ -34,7 +34,7 @@ func (b *multiArg) String() string { // The second method is Set(value string) error func (b *multiArg) Set(value string) error { - logrus.Infof("appending to multi args %s", value) + logrus.Debugf("appending to multi args %s", value) *b = append(*b, value) return nil }