From e6bf36b06da91bac8b0fcd11efe7a1b0ddc74708 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Tue, 7 Apr 2020 17:43:13 -0400 Subject: [PATCH] mantle/ore: glcoud: add ability to specify image description for gcp uploads GCP expects a certain image description to be attached to images in the format of `DISTRO, DISTRO RELEASE, VERSION, INFO`. We need to be able to specify a description for our images when they are created. --- mantle/cmd/ore/gcloud/upload.go | 18 +++++++++++------- src/cosalib/gcp.py | 5 +++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mantle/cmd/ore/gcloud/upload.go b/mantle/cmd/ore/gcloud/upload.go index 0c4e1f04cc..c39984a291 100644 --- a/mantle/cmd/ore/gcloud/upload.go +++ b/mantle/cmd/ore/gcloud/upload.go @@ -36,13 +36,14 @@ var ( Run: runUpload, } - uploadBucket string - uploadImageName string - uploadFile string - uploadFedora bool - uploadForce bool - uploadWriteUrl string - uploadImageFamily string + uploadBucket string + uploadImageName string + uploadFile string + uploadFedora bool + uploadForce bool + uploadWriteUrl string + uploadImageFamily string + uploadImageDescription string ) func init() { @@ -56,6 +57,7 @@ func init() { cmdUpload.Flags().BoolVar(&uploadForce, "force", false, "overwrite existing GS and GCE images without prompt") cmdUpload.Flags().StringVar(&uploadWriteUrl, "write-url", "", "output the uploaded URL to the named file") cmdUpload.Flags().StringVar(&uploadImageFamily, "family", "", "GCP image family to attach image to") + cmdUpload.Flags().StringVar(&uploadImageDescription, "description", "", "The description that should be attached to the image") GCloud.AddCommand(cmdUpload) } @@ -132,6 +134,7 @@ func runUpload(cmd *cobra.Command, args []string) { Name: imageNameGCE, Family: uploadImageFamily, SourceImage: storageSrc, + Description: uploadImageDescription, }, uploadForce, uploadFedora) if err == nil { err = pending.Wait() @@ -152,6 +155,7 @@ func runUpload(cmd *cobra.Command, args []string) { Name: imageNameGCE, Family: uploadImageFamily, SourceImage: storageSrc, + Description: uploadImageDescription, }, true, uploadFedora) if err == nil { err = pending.Wait() diff --git a/src/cosalib/gcp.py b/src/cosalib/gcp.py index db420cc751..56809c6a3c 100644 --- a/src/cosalib/gcp.py +++ b/src/cosalib/gcp.py @@ -70,6 +70,8 @@ def gcp_run_ore(build, args): ore_args.extend(['--fcos']) if args.family: ore_args.extend(['--family', args.family]) + if args.description: + ore_args.extend(['--description', args.description]) run_verbose(ore_args) build.meta['gcp'] = { @@ -116,4 +118,7 @@ def gcp_cli(parser): parser.add_argument("--family", help="GCP image family to attach image to", default=None) + parser.add_argument("--description", + help="The description that should be attached to the image", + default=None) return parser