Merge pull request #1522 from dave-tucker/gce-gcp

Use GCP everywhere for consistency
This commit is contained in:
Justin Cormack 2017-04-06 17:27:15 +01:00 committed by GitHub
commit 430f03b6a0
4 changed files with 15 additions and 14 deletions

View File

@ -122,7 +122,7 @@ func (g GCPClient) UploadFile(filename, bucketName string, public bool) error {
return nil
}
// CreateImage creates a GCE image using the a source from Google Storage
// CreateImage creates a GCP image using the a source from Google Storage
func (g GCPClient) CreateImage(filename, storageURL, family string, replace bool) error {
if replace {
if err := g.DeleteImage(filename); err != nil {
@ -174,7 +174,7 @@ func (g GCPClient) DeleteImage(filename string) error {
return nil
}
// CreateInstance creates and starts an instance on GCE
// CreateInstance creates and starts an instance on GCP
func (g GCPClient) CreateInstance(image, zone, machineType string, replace bool) error {
if replace {
if err := g.DeleteInstance(image, zone, true); err != nil {

View File

@ -13,7 +13,7 @@ import (
const (
bios = "mobylinux/mkimage-iso-bios:489b1f054a77a8f379d0bfc6cd91639b4db6b67c@sha256:0f058951aac4367d132682aa19eeb5cdcb05600a5d51fe5d0fcbd97b03ae4f87"
efi = "mobylinux/mkimage-iso-efi:1b0ea6b8a7956e67e903876be5baf476e9a5cc40@sha256:a026cd9e9d0146503274e575a165039c67b853bde0013ade78df80d9280ffa7c"
gce = "mobylinux/mkimage-gce:2039be4e39e855d1845aee188e266bba3f1d2eed@sha256:e12f76003fd9eaa0c6f39f149db5998cf56de42539b989c994893c8344ca69c0"
gcp = "mobylinux/mkimage-gcp:bd1197356ca69a4b79999cc56cb6d7dbac96723c@sha256:2a8c90214318f8da7f02066cc142add279a2e4772b26023961991d5fae3155ec"
qcow = "mobylinux/mkimage-qcow:9b3632f111675898ed3a22ac71897e735b5a8364@sha256:2132cf3fb593d65f09c8d109d40e1fad138d81485d4750fc29a7f54611d78d35"
vhd = "mobylinux/mkimage-vhd:73c80e433bf717578c507621a84fd58cec27fe95@sha256:0ae1eda2d6592f309977dc4b25cca120cc4e2ee2cc786e88fdc2761c0d49cb14"
vmdk = "mobylinux/mkimage-vmdk:1de360a30f3ac6a91d4eae1ae4611cea4b82f22a@sha256:d7e65edc6dd88f6e12dcb0d749d4c7e5793d1250e548b58c105dbfd082940787"
@ -38,18 +38,18 @@ 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-img":
err := outputImg(gce, base+".img.tar.gz", bzimage, initrd, m.Kernel.Cmdline)
case "gcp-img":
err := outputImg(gcp, base+".img.tar.gz", bzimage, initrd, m.Kernel.Cmdline)
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)
case "gcp-storage":
err := outputImg(gcp, 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")
return fmt.Errorf("No bucket specified for GCP output")
}
gClient, err := NewGCPClient(o.Keys, o.Project)
if err != nil {
@ -59,13 +59,13 @@ func outputs(m *Moby, base string, bzimage []byte, initrd []byte) error {
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)
case "gcp":
err := outputImg(gcp, 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")
return fmt.Errorf("No bucket specified for GCP output")
}
gClient, err := NewGCPClient(o.Keys, o.Project)
if err != nil {

View File

@ -14,6 +14,7 @@ func runUsage() {
fmt.Printf("'backend' specifies the run backend.\n")
fmt.Printf("If not specified the platform specific default will be used\n")
fmt.Printf("Supported backends are (default platform in brackets):\n")
fmt.Printf(" gcp\n")
fmt.Printf(" hyperkit [macOS]\n")
fmt.Printf(" vmware\n")
fmt.Printf("\n")

View File

@ -15,18 +15,18 @@ func runGcp(args []string) {
gcpCmd.Usage = func() {
fmt.Printf("USAGE: %s run gcp [options] [name]\n\n", os.Args[0])
fmt.Printf("'name' specifies either the name of an already uploaded\n")
fmt.Printf("GCE image or the full path to a image file which will be\n")
fmt.Printf("GCP image or the full path to a image file which will be\n")
fmt.Printf("uploaded before it is run.\n\n")
fmt.Printf("Options:\n\n")
gcpCmd.PrintDefaults()
}
zone := gcpCmd.String("zone", "europe-west1-d", "GCP Zone")
machine := gcpCmd.String("machine", "g1-small", "GCE Machine Type")
machine := gcpCmd.String("machine", "g1-small", "GCP Machine Type")
keys := gcpCmd.String("keys", "", "Path to Service Account JSON key file")
project := gcpCmd.String("project", "", "GCP Project Name")
bucket := gcpCmd.String("bucket", "", "GS Bucket to upload to. *Required* when 'prefix' is a filename")
public := gcpCmd.Bool("public", false, "Select if file on GS should be public. *Optional* when 'prefix' is a filename")
family := gcpCmd.String("family", "", "GCE Image Family. A group of images where the family name points to the most recent image. *Optional* when 'prefix' is a filename")
family := gcpCmd.String("family", "", "GCP Image Family. A group of images where the family name points to the most recent image. *Optional* when 'prefix' is a filename")
gcpCmd.Parse(args)
remArgs := gcpCmd.Args()