Project

Profile

Help

Issue #8714

closed

Collection highest_version includes pre-releases

Added by fao89 almost 3 years ago. Updated over 2 years ago.

Status:
CLOSED - DUPLICATE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Ticket moved to GitHub: "pulp/pulp_ansible/723":https://github.com/pulp/pulp_ansible/issues/723


Under /v3/collections/// highest_version.version includes pre-releases, for example "version": "2.2.8-pre1". The expectation likely is that this should not include pre-releases.

The list of all versions, /v3/collections///versions/ includes pre-releases and this is expected.

Actions #1

Updated by fao89 almost 3 years ago

In [1]: import semantic_version

In [2]: versions = [ "3.0.0-alpha", "2.5.8", "2.0.0-alpha", "2.0.1-alpha", "1.5.0"]

In [3]: sorted(versions,key=lambda obj: semantic_version.Version(obj), reverse=True)
Out[3]: ['3.0.0-alpha', '2.5.8', '2.0.1-alpha', '2.0.0-alpha', '1.5.0']

In [4]: filtered_versions = list(filter(lambda v: not semantic_version.Version(v).prerelease, versions))

In [5]: highest = sorted(filtered_versions, key=lambda obj: semantic_version.Version(obj), reverse=True)[0] if filtered_versions else sorted(versions,key=lambda obj: semantic_version.Version(obj), reverse=True)[0]

In [6]: highest
Out[6]: '2.5.8'

Affected code:

  1. v3: https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/app/galaxy/v3/serializers.py#L67-L73
  2. v2: https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/app/galaxy/serializers.py#L104-L108
  3. v2: https://github.com/pulp/pulp_ansible/blob/master/pulp_ansible/app/tasks/collections.py#L302-L323
Actions #2

Updated by fao89 over 2 years ago

  • Sprint/Milestone set to 1.0.0 - Candidates
Actions #3

Updated by pulpbot over 2 years ago

  • Description updated (diff)
  • Status changed from NEW to CLOSED - DUPLICATE

Also available in: Atom PDF