ci: prevent detecting latest Kubernetes patch release

In case the version that is passed with --version=... contains the patch
release already, the latest patch release will not be detected, but the
passed version will be returned (enables forcing a particular version in
CI jobs).

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-10-15 10:52:54 +02:00 committed by mergify[bot]
parent 89783afcf5
commit 535315cc29

View File

@ -1,7 +1,10 @@
#!/usr/bin/python #!/usr/bin/python
''' '''
Fetches the Kubernetes releases from GitHub and returns the most recent patch Fetches the Kubernetes releases from GitHub and returns the most recent patch
release for a major version. release for a major version (like 1.19). In case the version that is passed
contains the patch release already, the latest patch release will not be
detected, but the passed version will be returned (enables forcing a particular
version in CI jobs).
Parameters: Parameters:
--version=<version>: the major version to find the latest patch release for, i.e. v1.19 --version=<version>: the major version to find the latest patch release for, i.e. v1.19
@ -101,6 +104,12 @@ def main():
if not version.startswith('v'): if not version.startswith('v'):
version = 'v' + version version = 'v' + version
# when version already contains the patch release, do not run any
# detection
if len(version.split('.')) >= 3:
print(version)
sys.exit(0)
# releases are ordered from newest to oldest, so the 1st match is the # releases are ordered from newest to oldest, so the 1st match is the
# most current patch update # most current patch update
for release in releases: for release in releases: