Skip to content

[FEATURE] handle interdependency between packages in monorepo #414

@Tenshock

Description

@Tenshock

Is your feature request related to a problem? Please describe.
I have a monorepo with 3 packages:

  • package service_a is a micro-service under services/service_a
  • package service_b is a micro-service under services/service_b
  • package tool_z is a library libs/tool_z

Each package has a package declaration under [packages] cog.toml table.

My packages service_a and service_b use both the tool_z library.

Here is the thing: When I commit a change under tool_z library, only this package is bumped, both packages service_a and service_b are unchanged. They are currently cargo packages, and their respective Cargo.lock file are not updated within the bump commit generated.

The problem is more generic, how can I ensure that if in my monorepo, I bump a package, all my other packages using this very package are also bumped accordingly with all their potential dependencies?

The semver that should be used is also a thing, a breaking change requiring a major bump for the lib package does not necessarily need to trigger a major bump for the other packages using it for example.

Describe the solution you'd like
I don't know if it's a thing cocogitto must handle. I try to figure out the best way to handle this typology of problem. I have no well-crafted solution to propose currently.

Describe alternatives you've considered
Currently, I try to update manually after the bump for my top-level packages that I know use other lib-like packages to handle the thing. But it's quite not scalable and quite cumbersome.

Here is the extract of my cog.toml:

[packages]
service_a = { path = "services/service_a", pre_bump_hooks = [
        "cargo release version --execute --no-confirm {{version}}"
]}
service_b = { path = "services/service_b", pre_bump_hooks = [
        "cargo release version --execute --no-confirm {{version}}"
]}
tool_z = { path = "libs/tool_z", pre_bump_hooks = [
        "cargo release version --execute --no-confirm {{version}}",
        "cargo update --workspace --manifest-path ../services/service_a/Cargo.toml",
        "cargo update --workspace --manifest-path ../services/service_b/Cargo.toml"
]}

This solution only updates the relative Cargo.lock, this is a solution that is not agnostic, and my services does not have a version bump if I execute a bump with only a change under libs/tool_z.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions