Skip to content

Commit

Permalink
add warning when using both --local and KO_DOCKER_REPO to ko.local (k…
Browse files Browse the repository at this point in the history
…o-build#629)

Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato authored Jun 1, 2022
1 parent 4f46c1d commit aff9be7
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion pkg/commands/options/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

package options

import "log"
import (
"log"
"strings"
)

const bareBaseFlagsWarning = `WARNING!
-----------------------------------------------------------------
Expand All @@ -26,11 +29,25 @@ In a future release this will be an error.
-----------------------------------------------------------------
`

const localFlagsWarning = `WARNING!
-----------------------------------------------------------------
The --local flag is set and KO_DOCKER_REPO is set to ko.local
You can choose either one to build a local image.
The --local flag might be deprecated in the future.
-----------------------------------------------------------------
`

func Validate(po *PublishOptions, bo *BuildOptions) error {
if po.Bare && po.BaseImportPaths {
log.Print(bareBaseFlagsWarning)
// TODO: return error when we decided to make this an error, for now it is a warning
}

if po.Local && strings.Contains(po.DockerRepo, "ko.local") {
log.Print(localFlagsWarning)
}

return nil
}

0 comments on commit aff9be7

Please sign in to comment.