From 327138876aabcd2701dc6613d3706477cccff379 Mon Sep 17 00:00:00 2001
From: Dave Tucker
Date: Thu, 13 Apr 2017 12:56:11 +0100
Subject: [PATCH] moby: add skip-cleanup flag to moby run gcp
This is used as the CI will cleanup after itself
Signed-off-by: Dave Tucker
---
src/cmd/moby/run_gcp.go | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/cmd/moby/run_gcp.go b/src/cmd/moby/run_gcp.go
index f8d8b3e9c..b983b05b4 100644
--- a/src/cmd/moby/run_gcp.go
+++ b/src/cmd/moby/run_gcp.go
@@ -45,6 +45,7 @@ func runGcp(args []string) {
familyFlag := 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")
nameFlag := gcpCmd.String("img-name", "", "Overrides the Name used to identify the file in Google Storage, Image and Instance. Defaults to [name]")
diskSizeFlag := gcpCmd.Int("disk-size", 0, "Size of system disk in GB")
+ skipCleanup := gcpCmd.Bool("skip-cleanup", false, "Don't remove images or VMs")
if err := gcpCmd.Parse(args); err != nil {
log.Fatal("Unable to parse args")
@@ -107,7 +108,9 @@ func runGcp(args []string) {
log.Fatal(err)
}
- if err = client.DeleteInstance(name, zone, true); err != nil {
- log.Fatal(err)
+ if !*skipCleanup {
+ if err = client.DeleteInstance(name, zone, true); err != nil {
+ log.Fatal(err)
+ }
}
}