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

Add image map wiring #624

Merged
merged 3 commits into from
Sep 18, 2019
Merged

Conversation

jeremyrickard
Copy link
Contributor

@jeremyrickard jeremyrickard commented Sep 17, 2019

What does this change

This PR adds image map wiring / interpolation into Porter's bag of tricks. It changes the imageMap part of the porter.yaml to images to match the issue comments and does some various cleanup.

What issue does it fix

Closes #501

Notes

Since mustache template interpolation is case sensitive, I decided to use reflect to iterate the MappedImage struct and strings.ToLower the name of the field, that way it matches up against the yaml. Otherwise, we ended up with references like {{bundle.images.thing.Repository}}, which bugged me.

Checklist

  • Unit Tests
  • Documentation

This PR adds image map wiring / interpolation into Porter's bag of tricks.

Fixes: getporter#501
Copy link
Member

@vdice vdice left a comment

Choose a reason for hiding this comment

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

Nice! Only a few questions around non-code comments, etc.

images:
ALIAS:
description: A very useful image
imageType: docker # porter.yaml can default this to docker if we aren't already
Copy link
Member

Choose a reason for hiding this comment

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

Should the comment change to say porter is defaulting it to docker (if that's the case)?

description: A very useful image
imageType: docker # porter.yaml can default this to docker if we aren't already
repository: gcr.io/mcguffin-co/mcguffin
digest: sha256:85b1a9 # this is what bundle.json allows
Copy link
Member

Choose a reason for hiding this comment

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

Should we reference the cnab spec around the bundle.json file here?

imageType: docker # porter.yaml can default this to docker if we aren't already
repository: gcr.io/mcguffin-co/mcguffin
digest: sha256:85b1a9 # this is what bundle.json allows
tag: v1.1.0 # we can collect this and make it available but it won't land into bundle.json
Copy link
Member

Choose a reason for hiding this comment

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

It won't land into bundle.json b/c the digest sha is provided? Also, is the digest key/value mandatory or optional? (Or more generally, is it worth explicitly mentioning which fields are mandatory?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is probably better in a separate doc about images? What say you @carolynvs. We added that but never really documented it (there was a comment that we did nothing with it before). I was going to open a more general "document how to use images" issue that we could give best practice info in and explain how to use for Helm charts, etc.

// plan on manually using this data in your own scripts.
ImageMap map[string]MappedImage `yaml:"imageMap,omitempty"`
// ImageMap is a map of images referenced in the bundle. If image relocation mapping occurs, that
// file will be mounted at as a file at runtime to /cnab/app/relocation-mapping.json.
Copy link
Member

Choose a reason for hiding this comment

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

Extra at in ...file will be mounted at as a file...

Copy link
Member

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

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

@@ -3,9 +3,9 @@ title: Using Parameters, Credentials and Outputs
description: How to wire parameters, credentials and outputs into steps
---

# Parameters, Credentials and Outputs in Porter
# Parameters, Credentials, Outputs, and Images in Porter
Copy link
Member

Choose a reason for hiding this comment

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

Can you update this to be the title of the article instead in the front matter and remove this duplicate heading?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes indeed. it will require a change. thanks for catching that!

I'll update the headline in wiring.md too. Good suggestion.

@jeremyrickard
Copy link
Contributor Author

Updated the docs and the workshop, however, I couldn't verify the bundle since there is an
Azure outage related to MySQL. Feel free to review, but hold off on merging until I verify the bundle.

@jeremyrickard
Copy link
Contributor Author

@carolynvs @vdice I ran this locally again and it works. LMK if it's good to merge or if you want to take another look!

@jeremyrickard jeremyrickard merged commit cc2f0f8 into getporter:master Sep 18, 2019
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.

[proposal] Introduce imageMap wiring
3 participants