feat: wire river into JIMM's upgrade to handler#1845
Merged
kian99 merged 4 commits intocanonical:v3from Feb 3, 2026
Merged
Conversation
9582749 to
f451c0f
Compare
In internal/river tests we imported `"github.com/canonical/jimm/v3/internal/testutils/jimmtest"` for creation of test DBs. That package imports internal/jimm. Internal/jimm will (optionally) import internal/river if we have a wrapper around River's client. This change ensures DB creation is not wrapped up in this dependency tree.
luci1900
approved these changes
Feb 2, 2026
alesstimec
reviewed
Feb 2, 2026
| var newControllerName = fmt.Sprintf("controller-%d", time.Now().Unix()) | ||
|
|
||
| if targetVersion == version.Zero { | ||
| return 0, errors.E(errors.CodeBadRequest, "target version cannot be zero") |
Collaborator
There was a problem hiding this comment.
what's the added value of wrapping the error with errors.E in this case (and below)
Contributor
Author
There was a problem hiding this comment.
None (besides adding codes in this scenario), I think everyone just sticks errors.E everywhere since that's our standard approach. Which we'll hopefully get rid of soon.
alesstimec
reviewed
Feb 3, 2026
| } | ||
|
|
||
| // UpgradeEnqueuer defines the method to enqueue an upgrade job. | ||
| type UpgradeEnqueuer interface { |
Contributor
Author
There was a problem hiding this comment.
I wouldn't call it a manager since that term has some usage already in JIMM associated with the business logic domains.
SimoneDutto
approved these changes
Feb 3, 2026
Contributor
SimoneDutto
left a comment
There was a problem hiding this comment.
nice! it's very similar to what I set up originally! Plus the rivertypes.
Various little fixes I found while debugging the migrate+upgrade.
f451c0f to
d1de503
Compare
3 tasks
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.
Description
This PR wires up the River client into the JIMM domain layer, allowing us to insert river jobs as necessary.
The main challenge I faced with this was the potential for circular dependencies. To resolve this I've made a package called
rivertypes, thanks @luci1900 for the discussion on this. This package holds the job arguments that are used when inserting a job using the river client. The package go doc explains this nicely,There was one more issue with the tests, to try and summarise
internal/riverdepends on types frominternal/jimm/upgradefor itsUpgradeTointerface definition (though technically the current methods only use base types, but I've added a blank import to simulate the future problem).internal/jimmtest/helpers. The import cycle came from the fact thatinternal/jimmtest/importsinternal/jimm/andinternal/jimm/imports the thing river wrapper we have to make it easier to mock in tests.internal/jimmtest/dbtest/I recommend reviewing the commits separately.
Fixes JUJU-9057
Engineering checklist