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

Refactor CNAB adapter to support multiple dependencies extensions #2222

Closed
carolynvs opened this issue Jul 5, 2022 · 1 comment
Closed
Assignees
Labels
pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal

Comments

@carolynvs
Copy link
Member

The cnab adapter needs to be updated to support generating either v1 or v2 of the dependencies extension for inclusion in bundle.json. The first step is to just refactor the adapter so that it can differentiate between which extension it is working with.

I've already started this in #2099 but we need to split this out into a PR that just implements this new pattern for v1, so that we can incrementally add this feature into Porter. When we finally implement advanced dependencies in a later PR, then we should be able to update the adapter with the v2 logic, and the adapter will correctly handle generating either v1 or v2 depending on which the bundle is using.

func (c *ManifestConverter) generateDependencies() (interface{}, string, error) {
if len(c.Manifest.Dependencies.Requires) == 0 {
return nil, "", nil
}
// Check if they are using v1 of the dependencies spec
if c.Manifest.Dependencies.Requires[0].Reference != "" {
deps := c.generateDependenciesV1()
return deps, cnab.DependenciesV1ExtensionKey, nil
}
// Ok we are using v2!
deps, err := c.generateDependenciesV2()
return deps, cnab.DependenciesV2ExtensionKey, err
}

@carolynvs carolynvs added the pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal label Jul 5, 2022
@carolynvs carolynvs self-assigned this Jul 5, 2022
@getporterbot getporterbot added this to Inbox in Porter and Mixins Jul 5, 2022
@carolynvs carolynvs moved this from Inbox to In Progress in Porter and Mixins Jul 5, 2022
@carolynvs
Copy link
Member Author

Implemented in #2246

Porter and Mixins automation moved this from In Progress to Done Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal
Projects
Development

No branches or pull requests

1 participant