-
Notifications
You must be signed in to change notification settings - Fork 5
Add refresh v3 implementation #241
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
base: main
Are you sure you want to change the base?
Conversation
9a114c0
to
9de758b
Compare
Avoid passing refresh object since we know reconcile will be called later (no need to explicitly call it & have it run twice)
3fddbf4
to
d9bc860
Compare
d7d94fc
to
db4ec41
Compare
You can test the refresh with these charmhub branches (built on #242):
or modify the branch locally & re-pack the charm |
697ae63
to
ab25c33
Compare
Seems like the Is this right @carlcsaposs-canonical? |
ab25c33
to
3dd00a0
Compare
yes, see https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?tab=t.0 for more info |
Judging by PostgreSQL 16 tags, as well as the proposed contents in the Should we temporarily comment the new |
3dd00a0
to
87f9ef4
Compare
yes, temporarily reverting charmcraft.yaml changes & temporarily hard-coding charm version in refresh_versions.toml is okay for testing as long as we revert before merge |
87f9ef4
to
6dd5997
Compare
6dd5997
to
cc2af8d
Compare
Given this comment on the PostgreSQL refresh v3 implementation, my understanding is that the errors in the last CI run, are due to the refresh-v3 incompatibility to refresh from non refresh-v3 charms. Correct @carlcsaposs-canonical? Traceback:
|
Yes, (without a migration) refresh v3 does not support refreshing from non-refresh v3 charms The full traceback shows
|
6503990
to
a89e90a
Compare
a89e90a
to
86fceca
Compare
📢 This PR is now ready for review + merge DISCLAIMERS:
I made unit + integration tests pass, by relying on a a non-obvious setup, required by how refresh-v3 is implemented: How to make unit tests pass?
See commits: How to make integration tests pass?
See commits: Temporal changesDespite the described changes, refresh v3 can only be tested when upgrading from another refresh v3 charm (reference), in a repository which already started publishing charm versions as tags (in the case of MySQL Router:
See commits: Follow upNow the whole test suite passes, so this is ready to be merged + a refresh-v3 version of the charm published. WHenever that happens, we must create a follow-up PR in order to revert the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
(reviewed diff from fb9d59a)
charm = "8.0/1.1.0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
charm = "8.0/1.1.0" |
this needs to be removed before merging
also, I believe this will affect the integration test—we will need to run force-refresh-start
with check-compatibility=false
on PR CI (but not after merging) since development builds will be marked as incompatible (so that if a user ever accidentally deploys a development version of the charm, it's marked as incompatible). see postgresql-operator 16/edge for an example test that implements this
|
||
logger.info("Running resume-upgrade on the mysql router leader unit") | ||
await run_action(mysql_router_leader_unit, "resume-upgrade") | ||
logger.info("Running resume-refresh on the mysql router leader unit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.info("Running resume-refresh on the mysql router leader unit") | |
logger.info("Running resume-refresh") |
not necessarily leader
@@ -39,6 +35,7 @@ | |||
TEST_APP_NAME = APPLICATION_DEFAULT_APP_NAME | |||
|
|||
|
|||
@markers.amd64_only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be helpful for me to rebase #242 so that we can remove the amd64 only marker before merge?
# charm needs to refresh snap to be able to avoid no-op when upgrading. | ||
# set an old revision of the snap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider also setting verisons["workload"]
to avoid confusion in juju status
output of test
old_version = Version(versions["workload"]) | ||
new_version = Version(f"{old_version.major - 1}.{old_version.minor}.{old_version.micro}") | ||
versions["workload"] = str(new_version) | ||
versions["charm"] = "8.0/0.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: there's no need to update the workload version, setting charm version will be enough—which means we can get rid of the packaging import/dependency in integration tests
# Create venv in `..` so that git working tree is not dirty | ||
# python3 -m venv ../refresh-version-venv | ||
# source ../refresh-version-venv/bin/activate | ||
# poetry install --only build-refresh-version | ||
# write-charm-version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Create venv in `..` so that git working tree is not dirty | |
# python3 -m venv ../refresh-version-venv | |
# source ../refresh-version-venv/bin/activate | |
# poetry install --only build-refresh-version | |
# write-charm-version | |
# Create venv in `..` so that git working tree is not dirty | |
python3 -m venv ../refresh-version-venv | |
source ../refresh-version-venv/bin/activate | |
poetry install --only build-refresh-version | |
write-charm-version |
this needs to be applied before merge
def _tomli_load(*args, **kwargs) -> dict: | ||
return { | ||
"charm_major": 1, | ||
"workload": "8.0.0", | ||
"charm": "v8.0/1.0.0", | ||
"snap": { | ||
"name": "charmed-mysql", | ||
"revisions": { | ||
"x86_64": "1", | ||
"aarch64": "1", | ||
}, | ||
}, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would patching charm_refresh.snap_name
work instead? if so, I think we can write our mocks to not depend on charm_refresh's private api
Assumes snap is installed | ||
""" | ||
snap_name = charm_refresh.snap_name() | ||
snap_unit_path = pathlib.Path( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
snap_unit_path = pathlib.Path( | |
installed_by_unit = pathlib.Path( |
nit
(same for other instances of snap_unit_path)
@carlcsaposs-canonical , do you mind making the remaining changes? we can streamline the pr execution |
Uses
charm-refresh
Python package: https://github.com/canonical/charm-refresh