Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coreos-meta-translator: add gcp cloud launchable to release.json #112

Merged
merged 1 commit into from
Jun 18, 2020

Conversation

zonggen
Copy link
Member

@zonggen zonggen commented Jun 15, 2020

As AMIs have their own field images under the aws key, I think it might make sense for GCP to follow the same rule, adding an image field under the gcp key and rename the original image key to name.

If this is reasonable, it should be followed by updating fedora-coreos-stream-generator to support this PR. Finally, download page could read the GCP cloud launchable metadata from e.g. stable.json instead of meta.json

Related: coreos/fedora-coreos-tracker#494
Signed-off-by: Allen Bai abai@redhat.com

@zonggen
Copy link
Member Author

zonggen commented Jun 15, 2020

Continuation of #109, somehow GH does not allow me to reopen the PR, so moved to here.

zonggen pushed a commit to zonggen/fedora-coreos-stream-generator that referenced this pull request Jun 15, 2020
This change works with coreos/fedora-coreos-releng-automation#112
and adds the name, family and project metadata for GCP cloud launchable image from
release.json to $stream.json.

Signed-off-by: Allen Bai <abai@redhat.com>
Copy link
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though for some reason trying to parse this makes my brain hurt. One code comment suggestion.

arch_dict["media"]["gcp"] = arch_dict["media"].get("gcp", {})
arch_dict["media"]["gcp"]["image"] = arch_dict["media"]["gcp"].get("image", {})
arch_dict["media"]["gcp"]["image"].update(input_.get("gcp", {}))
if arch_dict["media"]["gcp"]["image"].get("image", None) is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be conditional? Feels like it should be an error if image wasn't in the input, no? IOW, can we drop this and instead just let pop error out if it's missing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emm.. I think this condition will always be true, since arch_dict["media"]["gcp"]["image"].update(input_.get("gcp", {})) made sure it is at least a {}. Anyway this is redundant, dropping this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

dustymabe pushed a commit to coreos/fedora-coreos-stream-generator that referenced this pull request Jun 18, 2020
This change works with coreos/fedora-coreos-releng-automation#112
and adds the name, family and project metadata for GCP cloud launchable image from
release.json to $stream.json.

Signed-off-by: Allen Bai <abai@redhat.com>
relrod pushed a commit to fedora-infra/fedora-websites-mirror that referenced this pull request Jun 18, 2020
Adds GCP cloud launchable name, family and project on the download
page. This works along side with
 - coreos/fedora-coreos-releng-automation#112 to add GCP info in release.json
 - coreos/fedora-coreos-stream-generator#11 to add GCP info in ${stream}.json

This change reads metadata from ${stream}.json and renders it. It is also possible to read directly
from individual meta.json file but since the download page is already utilizing ${stream}.json, this
changes is trying to make use of already fetched metadata instead of fetching another meta.json.

Closes: coreos/fedora-coreos-tracker#494
Signed-off-by: Allen Bai <abai@redhat.com>
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, but LGTM as is too.

arch_dict["media"]["gcp"] = arch_dict["media"].get("gcp", {})
arch_dict["media"]["gcp"]["image"] = arch_dict["media"]["gcp"].get("image", {})
arch_dict["media"]["gcp"]["image"].update(input_.get("gcp", {}))
arch_dict["media"]["gcp"]["image"]["name"] = arch_dict["media"]["gcp"]["image"].pop("image", None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion is to make it a hard error so we don't silently continue if image is missing from meta.json:

Suggested change
arch_dict["media"]["gcp"]["image"]["name"] = arch_dict["media"]["gcp"]["image"].pop("image", None)
arch_dict["media"]["gcp"]["image"]["name"] = arch_dict["media"]["gcp"]["image"].pop("image")

Copy link
Member Author

@zonggen zonggen Jun 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, and the previous pop("image") too. Updatinged

@jlebon jlebon merged commit 895b801 into coreos:master Jun 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants