mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-21 18:11:35 +00:00
moby: add skip-cleanup flag to moby run gcp
This is used as the CI will cleanup after itself Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
parent
f2d6752751
commit
bbe8078755
@ -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")
|
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]")
|
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")
|
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 {
|
if err := gcpCmd.Parse(args); err != nil {
|
||||||
log.Fatal("Unable to parse args")
|
log.Fatal("Unable to parse args")
|
||||||
@ -107,7 +108,9 @@ func runGcp(args []string) {
|
|||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = client.DeleteInstance(name, zone, true); err != nil {
|
if !*skipCleanup {
|
||||||
log.Fatal(err)
|
if err = client.DeleteInstance(name, zone, true); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user