Skip to content

Commit

Permalink
mantle/ore: glcoud: add ability to specify image description for gcp …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
dustymabe authored and openshift-merge-robot committed Apr 7, 2020
1 parent b58426e commit e6bf36b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
18 changes: 11 additions & 7 deletions mantle/cmd/ore/gcloud/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
}

Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions src/cosalib/gcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = {
Expand Down Expand Up @@ -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

0 comments on commit e6bf36b

Please sign in to comment.