add build steps
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
|
||||
"git.front.kjuulh.io/kjuulh/dagger-go/internal"
|
||||
"git.front.kjuulh.io/kjuulh/dagger-go/pkg/tasks"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func Build(requirementsf func(*cobra.Command), buildf func(ctx context.Context) error) *cobra.Command {
|
||||
func Build() *cobra.Command {
|
||||
var (
|
||||
imageTag string
|
||||
)
|
||||
@@ -20,21 +20,22 @@ func Build(requirementsf func(*cobra.Command), buildf func(ctx context.Context)
|
||||
return err
|
||||
}
|
||||
|
||||
if imageTag != "" {
|
||||
log.Printf("Building image: %s\n", imageTag)
|
||||
}
|
||||
ctx := cmd.Context()
|
||||
|
||||
if buildf != nil {
|
||||
return buildf(cmd.Context())
|
||||
}
|
||||
log.Printf("Building image: %s\n", imageTag)
|
||||
|
||||
return tasks.Build(imageTag)
|
||||
client, err := internal.New(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer client.CleanUp()
|
||||
|
||||
return tasks.Build(client, imageTag)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().StringVar(&imageTag, "image-tag", "", "the url for which to tag the docker image, defaults to private url, with repo as image name")
|
||||
|
||||
requirementsf(cmd)
|
||||
cmd.MarkPersistentFlagRequired("image-tag")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
Reference in New Issue
Block a user