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

Support different versions per instance of a component #559

Merged
merged 19 commits into from
Jan 31, 2025

Conversation

simu
Copy link
Member

@simu simu commented Jul 19, 2022

This PR changes Commodore to

  • Create separate worktrees for each component alias
  • Create class symlinks for each component alias
  • Create each alias target with only the defaults and component class symlinked from the alias worktree
  • Read instance versions from parameters.components.<instance-name>

Note that per-instance versions only work correctly only for components which use ${_base_directory} in their config when specifying Jsonnet files or Helm chart/YAML locations in kapitan.compile and kapitan.dependencies. Note, that components should use ${_base_directory} anyway, and new components created from the template use ${_base_directory} out of the box.

TODO:

  • Implement support for overriding the URL or path for individual component instances
  • Test cases which cover new features

Resolves #563

Checklist

  • Keep pull requests small so they can be easily reviewed.
  • Update the documentation.
  • Update tests.
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog

@simu simu changed the title Suppor different versions per instance of a component Support different versions per instance of a component Jul 19, 2022
@simu simu added the enhancement New feature or request label Jul 19, 2022
simu added 2 commits July 19, 2022 17:00
Recent pylint (or Python+pylint) versions can deal with `Optional[str]`
and similar type annotations without requiring the pylint annotation
`# pylint: disable=unsubscriptable-object`.
Implemented:
* Create separate worktrees for each component alias
* Create class symlinks for each component alias
* Create each alias target with only the defaults and component class
  for the alias worktree
* Works only for components which use `${_base_directory}` in their
  config (kapitan.compile and kapitan.dependencies mainly)

TODO:
* Actually allow users to specify version for each alias separately
* Cleanup changes
* Add tests
* Update docs
@simu simu force-pushed the feat/per-alias-versions branch from cd837a7 to 7322392 Compare July 19, 2022 15:00
simu added 3 commits July 19, 2022 17:04
We add support for specifying instance versions in
`parameters.components`. Commodore falls back to the version/url/path
specified for the component when the keys are not provided for component
aliases.

Note that the actual dependency handling doesn't yet support overriding
URL/path for aliases.
- Fix compile tests by falling back to old component path if no
  dependencies object is present
- Fix git tree tests by allowing dependency repos with no Author
  information on components
- Fix using the correct path for rendering aliased targets
@HappyTetrahedron HappyTetrahedron force-pushed the feat/per-alias-versions branch from 0e6e4cd to a588aea Compare January 8, 2025 09:28
@HappyTetrahedron HappyTetrahedron requested a review from a team January 21, 2025 19:19
@simu simu marked this pull request as ready for review January 22, 2025 15:16
@simu simu requested a review from a team as a code owner January 22, 2025 15:16
commodore/config.py Outdated Show resolved Hide resolved
commodore/dependency_mgmt/__init__.py Outdated Show resolved Hide resolved
commodore/dependency_mgmt/version_parsing.py Outdated Show resolved Hide resolved
commodore/component/__init__.py Outdated Show resolved Hide resolved
commodore/dependency_mgmt/__init__.py Outdated Show resolved Hide resolved
tests/test_component.py Outdated Show resolved Hide resolved
commodore/cluster.py Show resolved Hide resolved
commodore/dependency_mgmt/__init__.py Outdated Show resolved Hide resolved
commodore/dependency_mgmt/__init__.py Outdated Show resolved Hide resolved
Copy link
Member Author

@simu simu left a comment

Choose a reason for hiding this comment

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

LGTM now (once my final comments are addressed).

docs/modules/ROOT/pages/reference/architecture.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/reference/architecture.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/reference/architecture.adoc Outdated Show resolved Hide resolved
@simu
Copy link
Member Author

simu commented Jan 31, 2025

I've updated the SDD to match the final implementation: projectsyn/documentation#184

@simu simu merged commit 62d7637 into master Jan 31, 2025
19 of 20 checks passed
@simu simu deleted the feat/per-alias-versions branch January 31, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to specify different versions for different instances of the same component
2 participants