@@ -35,17 +35,18 @@ import (
3535
3636type buildOptions struct {
3737 * ProjectOptions
38- quiet bool
39- pull bool
40- push bool
41- args []string
42- noCache bool
43- memory cliopts.MemBytes
44- ssh string
45- builder string
46- deps bool
47- print bool
48- check bool
38+ quiet bool
39+ pull bool
40+ push bool
41+ args []string
42+ noCache bool
43+ memory cliopts.MemBytes
44+ ssh string
45+ builder string
46+ deps bool
47+ print bool
48+ check bool
49+ provenance string
4950}
5051
5152func (opts buildOptions ) toAPIBuildOptions (services []string ) (api.BuildOptions , error ) {
@@ -69,20 +70,27 @@ func (opts buildOptions) toAPIBuildOptions(services []string) (api.BuildOptions,
6970 if uiMode == ui .ModeJSON {
7071 uiMode = "rawjson"
7172 }
73+ var provenance * string
74+ // empty when set by up, run or create functions and "none" when set by the user from the build command
75+ if opts .provenance != "" && opts .provenance != "none" {
76+ provenance = & opts .provenance
77+ }
78+
7279 return api.BuildOptions {
73- Pull : opts .pull ,
74- Push : opts .push ,
75- Progress : uiMode ,
76- Args : types .NewMappingWithEquals (opts .args ),
77- NoCache : opts .noCache ,
78- Quiet : opts .quiet ,
79- Services : services ,
80- Deps : opts .deps ,
81- Memory : int64 (opts .memory ),
82- Print : opts .print ,
83- Check : opts .check ,
84- SSHs : SSHKeys ,
85- Builder : builderName ,
80+ Pull : opts .pull ,
81+ Push : opts .push ,
82+ Progress : uiMode ,
83+ Args : types .NewMappingWithEquals (opts .args ),
84+ NoCache : opts .noCache ,
85+ Quiet : opts .quiet ,
86+ Services : services ,
87+ Deps : opts .deps ,
88+ Memory : int64 (opts .memory ),
89+ Print : opts .print ,
90+ Check : opts .check ,
91+ SSHs : SSHKeys ,
92+ Builder : builderName ,
93+ Provenance : provenance ,
8694 }, nil
8795}
8896
@@ -123,6 +131,7 @@ func buildCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service)
123131 flags .StringVar (& opts .ssh , "ssh" , "" , "Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent)" )
124132 flags .StringVar (& opts .builder , "builder" , "" , "Set builder to use" )
125133 flags .BoolVar (& opts .deps , "with-dependencies" , false , "Also build dependencies (transitively)" )
134+ flags .StringVar (& opts .provenance , "provenance" , "max" , "Set provenance mode (none|min|max)" )
126135
127136 flags .Bool ("parallel" , true , "Build images in parallel. DEPRECATED" )
128137 flags .MarkHidden ("parallel" ) //nolint:errcheck
0 commit comments