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

Resolve dependency to using version ranges #2683

Open
Tracked by #2678
carolynvs opened this issue Mar 31, 2023 · 0 comments
Open
Tracked by #2678

Resolve dependency to using version ranges #2683

carolynvs opened this issue Mar 31, 2023 · 0 comments
Labels
pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal

Comments

@carolynvs
Copy link
Member

carolynvs commented Mar 31, 2023

When a bundle defines an advanced dependency, it can specify a default implementation and a semver constraint for matching against other versions of that bundle.

First, we need to add a configuration setting, dependencies.version-strategy, that indicates if/how porter can select another version of the default bundle implementation. By default this setting is off, and Porter will use the default implementation specified in the dependency.

The flag would be --dependencies-version-strategy=max

# ~/.porter/config.yaml
dependencies:
  version-strategy: max # defaults to exact

And here's an example bundle demonstrating the version range:

# porter.yaml
dependencies:
  requires:
  - name: mysql
    bundle:
      reference: example.com/mysql:v1.2.3
      version: v1.x

When porter is executed with the setting enabled (via the config file, env var or command flag), porter should retrieve all tags for the referenced bundle and check for the highest semver value that matches the constraint AND meets all requirements for the bundle (such as the bundle interface).

This setting applies to both selecting a single dependency, and when determining if two dependencies on the same bundle can share the node by selecting a compatible version. So if depA wants a bundle at 1.x, and depB wants 1.5.x, we would use the strategy to select either the max or min matching version between the two strategies.

Supported Strategies

  • exact, use the exact version/digest from the default implementation
  • max-patch, use the highest matching patch version
  • max-minor, use the highest matching minor version
  • min, use the lowest matching version, similar to go

ℹ️ Read PEP003 - Advanced Dependencies for context about how dependencies should work, design details, and notes about desired behavior.

@carolynvs carolynvs added the pep003-advanced-dependencies Implementation of the Advanced Dependencies proposal label Mar 31, 2023
@carolynvs carolynvs changed the title Resolve dependency to the most recent allowed version Resolve dependency to using version ranges Mar 31, 2023
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
No open projects
Status: No status
Development

No branches or pull requests

1 participant