diff --git a/builder/publish.go b/builder/publish.go index 0800dd433..07b2018b9 100644 --- a/builder/publish.go +++ b/builder/publish.go @@ -5,6 +5,7 @@ package builder import ( "fmt" + "log" "os" "strings" @@ -111,7 +112,11 @@ func getDockerBuildxCommand(build dockerBuild) (string, []string) { args = append(args, flagSlice...) + args = append(args, "--tag", build.Image, ".") + + log.Println(build.ExtraTags, len(build.ExtraTags)) for _, t := range build.ExtraTags { + log.Println("Do", t) var tag string if i := strings.LastIndex(build.Image, ":"); i > -1 { tag = applyTag(i, build.Image, t) @@ -121,8 +126,6 @@ func getDockerBuildxCommand(build dockerBuild) (string, []string) { args = append(args, "--tag", tag) } - args = append(args, "--tag", build.Image, ".") - command := "docker" return command, args diff --git a/commands/publish.go b/commands/publish.go index 0aff0a0c6..9297d5dfb 100644 --- a/commands/publish.go +++ b/commands/publish.go @@ -42,7 +42,7 @@ func init() { publishCmd.Flags().BoolVar(&quietBuild, "quiet", false, "Perform a quiet build, without showing output from Docker") publishCmd.Flags().BoolVar(&disableStackPull, "disable-stack-pull", false, "Disables the template configuration in the stack.yml") publishCmd.Flags().StringVar(&platforms, "platforms", "linux/amd64", "A set of platforms to publish") - publishCmd.Flags().StringArrayVar(&extraTags, "extra-tag", []string{""}, "Additional extra image tag") + publishCmd.Flags().StringArrayVar(&extraTags, "extra-tag", []string{}, "Additional extra image tag") // Set bash-completion. _ = publishCmd.Flags().SetAnnotation("handler", cobra.BashCompSubdirsInDir, []string{}) @@ -84,7 +84,7 @@ See also: faas-cli build`, faas-cli publish --build-option dev faas-cli publish --tag sha `, - PreRunE: preRunBuild, + PreRunE: preRunPublish, RunE: runPublish, } @@ -104,6 +104,10 @@ func preRunPublish(cmd *cobra.Command, args []string) error { return fmt.Errorf("the --parallel flag must be great than 0") } + if len(yamlFile) == 0 { + return fmt.Errorf("--yaml or -f is required") + } + return err }