feat: resolve dependency version ranges#3572
Draft
kichristensen wants to merge 9 commits intogetporter:mainfrom
Draft
feat: resolve dependency version ranges#3572kichristensen wants to merge 9 commits intogetporter:mainfrom
kichristensen wants to merge 9 commits intogetporter:mainfrom
Conversation
6aa9aab to
4627e47
Compare
Add DependenciesConfig struct, constants for the four strategies (exact, max-patch, max-minor, min), and GetDependenciesVersionStrategy accessor that defaults to "exact". Signed-off-by: Kim Christensen <kimworking@gmail.com>
- Add versionStrategy field and WithVersionStrategy builder - Update filterAndSelectTag to accept a version constraint and respect min vs max ordering - Update determineDefaultTag(v2) to pass constraint through - Fix ResolveVersion (v1): resolve ranges via strategy; error on exact + range-only - Fix ResolveVersionv2 (v2): resolve version constraint string via strategy instead of returning the ref unchanged - Update tests: replace "not implemented" case with strategy cases Signed-off-by: Kim Christensen <kimworking@gmail.com>
- Add DependenciesVersionStrategy to BundleExecutionOptions - Wire flag > global config fallback in identifyDependencies - Add --dependencies-version-strategy flag to install and upgrade commands with viper-key binding to dependencies.version-strategy Signed-off-by: Kim Christensen <kimworking@gmail.com>
- Config accessor: TestGetDependenciesVersionStrategy (unit) - Config loading: file, env var, env-over-file (unit) - Extended bundle v2: TestExtendedBundle_ResolveVersionv2 with all strategies and error cases (unit) - Integration: config file, env var, multi-context config loading of dependencies.version-strategy (integration tag) Signed-off-by: Kim Christensen <kimworking@gmail.com>
- Add registryListTagsAdapter to fix registry mock wiring - Add unit tests (pkg/porter/dependencies_test.go) covering exact/max-patch/min/max-minor strategies and config fallback - Add integration tests (tests/integration/) for install and upgrade verifying strategy selection via MockPullBundle - Register new integration test in both CI workflows Signed-off-by: Kim Christensen <kimworking@gmail.com>
max-patch now restricts resolution to the same major.minor as the default version in the dependency reference. max-minor restricts to the same major version. Both strategies derive the narrowing constraint from the semver tag encoded in the bundle's dependency reference (e.g. example.com/mysql:v1.2.3). Add unit and integration tests covering both behaviors. Signed-off-by: Kim Christensen <kimworking@gmail.com>
Add dependencies.version-strategy to the configuration reference and config file example. Document the semantic difference between max-patch, max-minor, min, and exact, including how the default tag anchors the range. Add a Version Ranges section to the dependencies authoring guide with examples and a strategy comparison table. Signed-off-by: Kim Christensen <kimworking@gmail.com>
Signed-off-by: Kim Christensen <kimworking@gmail.com>
4627e47 to
bbfaf65
Compare
Signed-off-by: Kim Christensen <kimworking@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change
Adds a
dependencies.version-strategysetting that controls how Porter selects a bundle version when a dependency declares a semver version range instead of a pinned tag.Supported strategies:
exact(default) — error if the dependency specifies only a range and no pinned tagmax-patch— pick the highest patch release within the samemajor.minoras the default tag in the dependency referencemax-minor— pick the highest minor+patch release within the same major as the default tagmin— pick the lowest release satisfying the stated rangeThe setting can be configured via the config file, the
PORTER_DEPENDENCIES_VERSION_STRATEGYenvironment variable, or the--dependencies-version-strategyflag oninstallandupgrade.What issue does it fix
Partially resolves #2683 (part of epic #2678).
Not implemented: version reconciliation when two dependencies reference the same bundle with overlapping ranges (shared node selection described in #2683).
Notes for the reviewer
max-patchandmax-minorderive their narrowing constraint from the semver tag encoded in the bundle's dependency reference (e.g.example.com/mysql:v1.2.3). If no version tag is present in the default reference, both strategies fall back to picking the highest tag satisfying the stated range.Checklist