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

Target ceiling version #1008

Merged
merged 8 commits into from
Jan 25, 2024
Merged

Target ceiling version #1008

merged 8 commits into from
Jan 25, 2024

Conversation

cderici
Copy link
Contributor

@cderici cderici commented Jan 16, 2024

Description

Currently

  1. the “target” version is hardcoded,
  2. we spam debug output for any use of pylibjuju where the target version != juju controller version.

This reads the version from the VERSION file we keep at the toplevel. And removes the minor version sniffing.

We still keep the major version sniffing because of the two tracks we have in pylibjuju (2.9 and 3.x).

QA Steps

No added functionality, so no QA is needed other than reading the code.

If you wanna be really pedantic, set the logging to DEBUG and run the line above, and you shouldn't see any messages like

"This version was tested using ...... juju version ...... may have compatibility issues"

Notes & Discussion

JUJU-5315

rather then setting it to the TARGET_JUJU_VERSION
Currently we spam debug output for any use of pylibjuju where the
"target" != juju controller version. It should be turned into a
ceiling, as it’s pretty normal to use the latest pylibjuju (currently
3.3.0.0) against any 3.x controller (e.g. 3.1). The only time we emit
a warning should be when we think the client should be upgraded to a
more recent version (e.g. running pylibjuju 3.3.0.0 against juju
controller 3.6).
@cderici cderici added enhancement hint/3.x going on main branch labels Jan 16, 2024
In case this is run from somewhere else than the libjuju top directory
(e.g. sphinx).
@jack-w-shaw
Copy link
Member

QA problem (potentially)

I accidentally connected with a controller I had with version 3.4-rc1.1 and got the error

>>> await m.connect()
Traceback (most recent call last):
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "<console>", line 1, in <module>
  File "/home/jack/juju/python-libjuju/juju/model.py", line 667, in connect
    model_uuid = await self._connector.connect_model(model_name, **kwargs)
  File "/home/jack/juju/python-libjuju/juju/client/connector.py", line 191, in connect_model
    await self.connect(**kwargs)
  File "/home/jack/juju/python-libjuju/juju/client/connector.py", line 91, in connect
    juju_server_version = version.parse(self._connection.info["server-version"])
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/site-packages/packaging/version.py", line 54, in parse
    return Version(version)
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '3.4-rc1.1'

@jack-w-shaw
Copy link
Member

jack-w-shaw commented Jan 17, 2024

I'm not entirely familiar with how we version python-libjuju to track juju, but the behaviour around patch releases seems a little odd

i.e. if we have a 3.3.1 controller (3.3.1 is a candidate snap atm)

>>> await m.connect()
This client is tested up to the version 3.3.0 Juju controller. Detected a Juju controller version 3.3.1.1 that's higher than the 3.3.0. Some functionalities that the Juju 3.3.1.1 offers may not be available. Please consider upgrading to pylibjuju 3.3.1.1.
This client is tested up to the version 3.3.0 Juju controller. Detected a Juju controller version 3.3.1.1 that's higher than the 3.3.0. Some functionalities that the Juju 3.3.1.1 offers may not be available. Please consider upgrading to pylibjuju 3.3.1.1.

This would mean we would need to release a python-libjuju for every juju patch release? Idk if this is what we're currently doing

Copy link
Member

@SimonRichardson SimonRichardson left a comment

Choose a reason for hiding this comment

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

I'd like to just get rid of this completely. I'm not sure what it gives us.

We're actively removing these checks in juju 2.9+

@cderici
Copy link
Contributor Author

cderici commented Jan 17, 2024

I'd like to just get rid of this completely. I'm not sure what it gives us.

yeah, right? This was itching me since yesterday, it is sort of useful when someone accidentally uses the tip against a 2.9 controller and vice versa, cause otherwise without this it'll fail in mysterious ways, at least this is a bit of a gatekeeper of that. And I can't wait to finish my work on merging 2.9/3.x so I can completely get rid of this. But as long as we have 2 tracks for 2.9 and 3.x, I don't have a good solution of warning users without this being in place.

@cderici cderici requested a review from jack-w-shaw January 17, 2024 19:47
Copy link
Member

@jack-w-shaw jack-w-shaw left a comment

Choose a reason for hiding this comment

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

Getting errors running on 3.4-rc1

>>> await m.connect()
Traceback (most recent call last):
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/concurrent/futures/_base.py", line 458, in result
    return self.__get_result()
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
    raise self._exception
  File "<console>", line 1, in <module>
  File "/home/jack/juju/python-libjuju/juju/model.py", line 667, in connect
    model_uuid = await self._connector.connect_model(model_name, **kwargs)
  File "/home/jack/juju/python-libjuju/juju/client/connector.py", line 186, in connect_model
    await self.connect(**kwargs)
  File "/home/jack/juju/python-libjuju/juju/client/connector.py", line 91, in connect
    juju_server_version = version.parse(self._connection.info["server-version"])
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/site-packages/packaging/version.py", line 54, in parse
    return Version(version)
  File "/home/jack/.pyenv/versions/3.10.11/lib/python3.10/site-packages/packaging/version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '3.4-rc1.1'
$ juju controllers
Use --refresh option with this command to see the latest information.

Controller  Model  User   Access     Cloud/Region         Models  Nodes    HA  Version
lxd         -      admin  superuser  localhost/localhost       1      1  none  3.4-rc1.1  

This is a controller build from HEAD of 3.4 branch.

@jack-w-shaw
Copy link
Member

This seems to only be the case for controllers which were bootstrapped by uploading a local jujud binary, since these get the build version appended

@cderici
Copy link
Contributor Author

cderici commented Jan 23, 2024

Getting errors running on 3.4-rc1

Yeah this would be due to the packaging.version unable to parse that. I'll update the code to handle it, good catch! 👍

@cderici cderici requested a review from jack-w-shaw January 23, 2024 20:54
cderici added a commit to cderici/python-libjuju that referenced this pull request Jan 24, 2024
cderici added a commit to cderici/python-libjuju that referenced this pull request Jan 24, 2024
@cderici
Copy link
Contributor Author

cderici commented Jan 25, 2024

/merge

@jujubot jujubot merged commit 1cc3c58 into juju:master Jan 25, 2024
7 of 8 checks passed
cderici added a commit to cderici/python-libjuju that referenced this pull request Jan 26, 2024
@cderici cderici mentioned this pull request Feb 8, 2024
jujubot added a commit that referenced this pull request Feb 13, 2024
#1024

## What's Changed
* Remove paramiko upper-bound by @gboutry in #1005
* Remove explicit passing of event_loop into tests by @cderici in #1006
* chore: remove the upper restrictions on the websockets dependency by @tonyandrewmeyer in #1007
* Target ceiling version by @cderici in #1008
* Make it easier to run tests using `make` by @cderici in #1012
* Avoid installing signal handlers to the event loop by @cderici in #1014
* feat: remove app block until done by @yanksyoon in #1017
* feat: remove app timeout by @yanksyoon in #1018
* Forward port latest changes from 2.9 onto 3.x by @cderici in #1022

#### Notes & Discussion

JUJU-5414
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hint/3.x going on main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants