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

Do not assume that all bundles have a supported porter.yaml file #1974

Merged
merged 3 commits into from
Mar 16, 2022

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Mar 15, 2022

What does this change

These are changes necessary to have porter explain and porter inspect work with bundles created with an unsupported porter version.

Do not require a supported porter.yaml file in the bundle cache

It's important that we should be able to pull a bundle and fall back to working with it as a vanilla cnab bundle when it was built with an unsupported porter version. This removes trying to load the manifest from the bundle cache and each calling command will need to decide how to gracefully handle the bundle it pulls from the cache (i.e. some commands have to require a supported version, like build, but others like install can still work without a manifest).

Remove Porter.Manifest field
The porter struct has always had a Manifest field that is great at causing nil pointer exceptions (which is why I also fixed Porter to print out panic stack traces) because it's essentially a global variable and not all code paths populate it.

Since we need to support bundles that may not be able to populate a manifest, i.e. it's an unsupported manifest schema, or a vanilla CNAB bundle, I've removed it and made any commands that need the manifest to load it themselves instead of relying on this global.

What issue does it fix

Part of #1956

Notes for the reviewer

N/A

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

It's important that we should be able to pull a bundle and fall back to
working with it as a vanilla cnab bundle when it was built with an
unsupported porter version. This removes trying to load the manifest
from the bundle cache and each calling command will need to decide how
to gracefully handle the bundle it pulls from the cache (i.e. some
commands have to require a supported version, like build, but others
like install can still work without a manifest).

Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs force-pushed the remove-manifest-from-cache branch from b5f7957 to 8a0bcdc Compare March 16, 2022 13:22
@carolynvs carolynvs changed the base branch from main to release/v1 March 16, 2022 13:23
@carolynvs carolynvs changed the title Remove manifest from cache Do not assume that all bundles have a supported porter.yaml file Mar 16, 2022
@carolynvs
Copy link
Member Author

/azp run porter-integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@carolynvs
Copy link
Member Author

/azp run porter-integration

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

The porter struct has always had a Manifest field that is great at
causing nil pointer exceptions because it's essentially a global
variable and not all code paths populate it.

Since we need to support bundles that may not be able to populate a
manifest, i.e. it's an unsupported manifest schema, or a vanilla CNAB
bundle, I've removed it and made any commands that need the manifest to
load it themselves instead of relying on this global.

Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
@carolynvs carolynvs force-pushed the remove-manifest-from-cache branch from 844b521 to 9302eb6 Compare March 16, 2022 14:12
@carolynvs carolynvs marked this pull request as ready for review March 16, 2022 14:52
@carolynvs carolynvs requested a review from VinozzZ March 16, 2022 14:52
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.

LGTM

@carolynvs carolynvs merged commit 824d2c5 into getporter:release/v1 Mar 16, 2022
@carolynvs carolynvs deleted the remove-manifest-from-cache branch March 16, 2022 21:39
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.

2 participants