From bf7ab9f04cbff2716e0f63a628ef9cecc050b073 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 6 Apr 2017 16:56:20 +0100
Subject: [PATCH 1/3] tools: rename mkimage-gce to mkimage-gcp
Also removes `mobyplatform` from the cmdline as this is no longer used
Signed-off-by: Dave Tucker
---
tools/{mkimage-gce => mkimage-gcp}/Dockerfile | 2 +-
tools/{mkimage-gce => mkimage-gcp}/Makefile | 4 ++--
tools/{mkimage-gce/make-gce => mkimage-gcp/make-gcp} | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
rename tools/{mkimage-gce => mkimage-gcp}/Dockerfile (84%)
rename tools/{mkimage-gce => mkimage-gcp}/Makefile (93%)
rename tools/{mkimage-gce/make-gce => mkimage-gcp/make-gcp} (87%)
diff --git a/tools/mkimage-gce/Dockerfile b/tools/mkimage-gcp/Dockerfile
similarity index 84%
rename from tools/mkimage-gce/Dockerfile
rename to tools/mkimage-gcp/Dockerfile
index 5ec767ee5..0ee52d285 100644
--- a/tools/mkimage-gce/Dockerfile
+++ b/tools/mkimage-gcp/Dockerfile
@@ -2,4 +2,4 @@ FROM mobylinux/guestfs:69698aca5bfcb8c4d3a3bbe6d8656be155bf8cd6@sha256:703a7372a
COPY . .
-ENTRYPOINT [ "/make-gce" ]
+ENTRYPOINT [ "/make-gcp" ]
diff --git a/tools/mkimage-gce/Makefile b/tools/mkimage-gcp/Makefile
similarity index 93%
rename from tools/mkimage-gce/Makefile
rename to tools/mkimage-gcp/Makefile
index 934cb1808..e3734df3a 100644
--- a/tools/mkimage-gce/Makefile
+++ b/tools/mkimage-gcp/Makefile
@@ -1,10 +1,10 @@
.PHONY: tag push
-IMAGE=mkimage-gce
+IMAGE=mkimage-gcp
default: push
-hash: Dockerfile make-gce
+hash: Dockerfile make-gcp
tar cf - $^ | docker build --no-cache -t $(IMAGE):build -
docker run --entrypoint sh --rm $(IMAGE):build -c "(cat $^; apt list --installed 2>/dev/null) | sha1sum" | sed 's/ .*//' > hash
diff --git a/tools/mkimage-gce/make-gce b/tools/mkimage-gcp/make-gcp
similarity index 87%
rename from tools/mkimage-gce/make-gce
rename to tools/mkimage-gcp/make-gcp
index ef811b2e8..4cf5d1281 100755
--- a/tools/mkimage-gce/make-gce
+++ b/tools/mkimage-gcp/make-gcp
@@ -26,8 +26,8 @@ CMDLINE="$*"
# clean up subdirectories
find . -mindepth 1 -maxdepth 1 -type d | xargs rm -rf
-# should be externally provided as GCE specific
-GCE_CONFIG="earlyprintk=ttyS0,115200 console=ttyS0,115200 mobyplatform=gcp vsyscall=emulate page_poison=1"
+# should be externally provided as GCP specific
+GCP_CONFIG="earlyprintk=ttyS0,115200 console=ttyS0,115200 vsyscall=emulate page_poison=1"
CFG="DEFAULT linux
LABEL linux
From df1c66dd04d02401bda92fa7c49079bf90a0b6f0 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 6 Apr 2017 17:00:53 +0100
Subject: [PATCH 2/3] moby: Replace references to GCE with GCP
Signed-off-by: Dave Tucker
---
examples/gcp.yml | 2 +-
src/cmd/moby/gcp.go | 4 ++--
src/cmd/moby/output.go | 18 +++++++++---------
src/cmd/moby/run_gcp.go | 6 +++---
test/test.yml | 2 +-
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/examples/gcp.yml b/examples/gcp.yml
index 155e90171..5ecc988c2 100644
--- a/examples/gcp.yml
+++ b/examples/gcp.yml
@@ -73,7 +73,7 @@ files:
contents: '{"debug": true}'
outputs:
- format: kernel+initrd
- - format: gce
+ - format: gcp
project: moby
bucket: mobytestjustin
family: moby-dev
diff --git a/src/cmd/moby/gcp.go b/src/cmd/moby/gcp.go
index aefc6698a..80d2f435f 100644
--- a/src/cmd/moby/gcp.go
+++ b/src/cmd/moby/gcp.go
@@ -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 {
diff --git a/src/cmd/moby/output.go b/src/cmd/moby/output.go
index 171c58907..5d7bf1d5a 100644
--- a/src/cmd/moby/output.go
+++ b/src/cmd/moby/output.go
@@ -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 {
diff --git a/src/cmd/moby/run_gcp.go b/src/cmd/moby/run_gcp.go
index 4c743b992..32cedf4dc 100644
--- a/src/cmd/moby/run_gcp.go
+++ b/src/cmd/moby/run_gcp.go
@@ -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()
diff --git a/test/test.yml b/test/test.yml
index bc465465c..e7a650bee 100644
--- a/test/test.yml
+++ b/test/test.yml
@@ -30,4 +30,4 @@ outputs:
- format: kernel+initrd
- format: iso-bios
- format: iso-efi
- - format: gce-img
+ - format: gcp-img
From 1b485eff4c63ffe7a98c02a3d6c05b473435cb46 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 6 Apr 2017 17:10:04 +0100
Subject: [PATCH 3/3] moby: Add gcp platform to usage in moby run
Signed-off-by: Dave Tucker
---
src/cmd/moby/run.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/cmd/moby/run.go b/src/cmd/moby/run.go
index 24c470c1f..af8b4a121 100644
--- a/src/cmd/moby/run.go
+++ b/src/cmd/moby/run.go
@@ -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")