mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-11-12 08:06:35 +00:00
Add upload to Google Cloud Storage and Google Compute Image creation
- the image upload uses the cloud API - currently auth and image creation need the `gcloud` CLI tool. Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
28
output.go
28
output.go
@@ -39,6 +39,34 @@ func outputs(m *Moby, base string, bzimage []byte, initrd []byte) error {
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing %s output: %v", o.Format, err)
|
||||
}
|
||||
case "gce-storage":
|
||||
err := outputImg(gce, base+".img.tar.gz", bzimage, initrd, m.Kernel.Cmdline)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing %s output: %v", o.Format, err)
|
||||
}
|
||||
if o.Bucket == "" {
|
||||
return fmt.Errorf("No bucket specified for GCE output")
|
||||
}
|
||||
err = uploadGS(base+".img.tar.gz", o.Project, o.Bucket, o.Public)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error copying to Google Storage: %v", err)
|
||||
}
|
||||
case "gce":
|
||||
err := outputImg(gce, base+".img.tar.gz", bzimage, initrd, m.Kernel.Cmdline)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing %s output: %v", o.Format, err)
|
||||
}
|
||||
if o.Bucket == "" {
|
||||
return fmt.Errorf("No bucket specified for GCE output")
|
||||
}
|
||||
err = uploadGS(base+".img.tar.gz", o.Project, o.Bucket, o.Public)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error copying to Google Storage: %v", err)
|
||||
}
|
||||
err = imageGS(base, o.Project, "https://storage.googleapis.com/"+o.Bucket+"/"+base+".img.tar.gz")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error creating Google Compute Image: %v", err)
|
||||
}
|
||||
case "qcow", "qcow2":
|
||||
err := outputImg(qcow, base+".qcow2", bzimage, initrd, m.Kernel.Cmdline)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user