mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-10 05:27:07 +08:00
Implement --quiet
support
Signed-off-by: Andy Caldwell <andrew.caldwell@metaswitch.com>
This commit is contained in:
@ -54,6 +54,7 @@ type Options struct {
|
||||
BuildArgs map[string]string
|
||||
Pull bool
|
||||
ImageIDFile string
|
||||
Quiet bool
|
||||
ExtraHosts []string
|
||||
NetworkMode string
|
||||
|
||||
@ -683,8 +684,12 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do
|
||||
resp[k] = res[0]
|
||||
respMu.Unlock()
|
||||
if len(res) == 1 {
|
||||
digest := res[0].ExporterResponse["containerimage.digest"]
|
||||
if opt.Quiet {
|
||||
fmt.Println(digest)
|
||||
}
|
||||
if opt.ImageIDFile != "" {
|
||||
return ioutil.WriteFile(opt.ImageIDFile, []byte(res[0].ExporterResponse["containerimage.digest"]), 0644)
|
||||
return ioutil.WriteFile(opt.ImageIDFile, []byte(digest), 0644)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -713,6 +718,9 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if opt.Quiet {
|
||||
fmt.Println(desc.Digest)
|
||||
}
|
||||
if opt.ImageIDFile != "" {
|
||||
return ioutil.WriteFile(opt.ImageIDFile, []byte(desc.Digest), 0644)
|
||||
}
|
||||
|
Reference in New Issue
Block a user