Description
When developing a new feature for Salt on a recent checkout of the master branch, I expect salt.version.SaltStackVersion.current_release() to return the version of Salt that is in development (the upcoming release). Instead, it returns a historic, already released version. At the very least, it should return a version that is greater than or equal to salt.version.__saltstack_version__.
This matters for salt.utils.versions.warn_until(): If SaltStackVersion.current_release() always matches a past release instead of the upcoming release, then the act of creating a new Git tag can change Salt's behavior in severe ways (warnings turned into errors). Due to the lateness in the development cycle of the behavior change, it is unlikely to be thoroughly tested before the new release is published.
This also matters when developing a feature that is gated by Salt version; see #62932 (comment) for a specific example.
Steps to Reproduce the behavior
>>> import salt.version
>>> import salt.utils.versions
>>> salt.version__saltstack_version__
<SaltStackVersion name='Phosphorus' major=3005 minor=1 noc=922 sha=g93f871df58>
>>> salt.version.SaltStackVersion.current_release()
<SaltStackVersion name='Phosphorus' major=3005>
>>> salt.utils.versions.warn_until((3006, 0), "testing")
<stdin>:1: DeprecationWarning: testing
Expected behavior
>>> import salt.version
>>> import salt.utils.versions
>>> salt.version__saltstack_version__
<SaltStackVersion name='Phosphorus' major=3005 minor=1 noc=922 sha=g93f871df58>
>>> salt.version.SaltStackVersion.current_release()
<SaltStackVersion major=3006>
>>> salt.utils.versions.warn_until((3006, 0), "testing")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "salt/utils/versions.py", line 144, in warn_until
raise RuntimeError(
RuntimeError: The warning triggered on filename '<stdin>', line number 1, is supposed to be shown until version 3006.0 is released. Current version is now 3006.0. Please remove the warning.
Additional context
Interestingly, current_release() initially returns the upcoming release:
|
def current_release(cls): |
|
if cls._current_release is None: |
|
for version in cls.versions(): |
|
if version.released is False: |
|
cls._current_release = version |
|
break |
|
return cls._current_release |
It is forcibly changed to return the previous release later on:
|
__saltstack_version__ = __get_version(__saltstack_version__) |
|
if __saltstack_version__.name: |
|
# Set SaltVersionsInfo._current_release to avoid lookups when finding previous and next releases |
|
SaltVersionsInfo._current_release = getattr( |
|
SaltVersionsInfo, __saltstack_version__.name.upper() |
|
) |
Description
When developing a new feature for Salt on a recent checkout of the
masterbranch, I expectsalt.version.SaltStackVersion.current_release()to return the version of Salt that is in development (the upcoming release). Instead, it returns a historic, already released version. At the very least, it should return a version that is greater than or equal tosalt.version.__saltstack_version__.This matters for
salt.utils.versions.warn_until(): IfSaltStackVersion.current_release()always matches a past release instead of the upcoming release, then the act of creating a new Git tag can change Salt's behavior in severe ways (warnings turned into errors). Due to the lateness in the development cycle of the behavior change, it is unlikely to be thoroughly tested before the new release is published.This also matters when developing a feature that is gated by Salt version; see #62932 (comment) for a specific example.
Steps to Reproduce the behavior
Expected behavior
Additional context
Interestingly,
current_release()initially returns the upcoming release:salt/salt/version.py
Lines 199 to 205 in 6226b9c
It is forcibly changed to return the previous release later on:
salt/salt/version.py
Lines 649 to 654 in 6226b9c