mirror of
https://github.com/ko-build/ko.git
synced 2025-07-15 23:54:17 +02:00
Return better error messages (#33)
This hoists the publisher creation out of the loop for `ko publish` to avoid needlessly resolving credentials multiple times. This pulls the publisher creation outside of resolveFilesToWriter so we can fail earlier if e.g. KO_DOCKER_REPO is unset, otherwise we start up the kubectl goroutine and it would asynchronously fail with: error: no objects passed to apply
This commit is contained in:
@ -15,9 +15,11 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/google/ko/pkg/commands/options"
|
||||
"github.com/spf13/cobra"
|
||||
"os"
|
||||
)
|
||||
|
||||
// addResolve augments our CLI surface with resolve.
|
||||
@ -55,7 +57,15 @@ func addResolve(topLevel *cobra.Command) {
|
||||
ko resolve --local -f config/`,
|
||||
Args: cobra.NoArgs,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
resolveFilesToWriter(fo, no, lo, ta, do, os.Stdout)
|
||||
builder, err := makeBuilder(do)
|
||||
if err != nil {
|
||||
log.Fatalf("error creating builder: %v", err)
|
||||
}
|
||||
publisher, err := makePublisher(no, lo, ta)
|
||||
if err != nil {
|
||||
log.Fatalf("error creating publisher: %v", err)
|
||||
}
|
||||
resolveFilesToWriter(builder, publisher, fo, os.Stdout)
|
||||
},
|
||||
}
|
||||
options.AddLocalArg(resolve, lo)
|
||||
|
Reference in New Issue
Block a user