-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
enhancementenhancing, extending functionality, not refactor or net newenhancing, extending functionality, not refactor or net new
Description
We are using something like this to download the latest artifacts from our nexus:
deploy_artefact:
nexus.downloaded:
- artifact:
nexus_url: {{ salt['pillar.get']('nexus_url') }}
repository: 'some-nexus-repo'
artifact_id: 'some-service'
group_id: 'de.whatever'
packaging: 'jar'
version: 'latest'
- target_file: /opt/some-project.d/some-service.jar
If the maven-metadata.xml of this artifact looks like this:
<metadata modelVersion="1.1.0">
<groupId>wonderfull.group</groupId>
<artifactId>foo-bar</artifactId>
<versioning>
<latest>1.22.0-dev.30</latest>
<release>1.22.0-dev.30</release>
<versions>
<version>1.8.0-dev.7</version>
<version>1.8.0-dev.14</version>
<version>1.10.0-dev.15</version>
<version>1.11.0-dev.18</version>
<version>1.13.0-dev.20</version>
<version>1.15.0-dev.21</version>
<version>1.16.0-dev.24</version>
<version>1.19.0-dev.26</version>
<version>1.20.0-dev.27</version>
<version>1.20.0-dev.29</version>
<version>1.22.0-dev.30</version>
</versions>
<lastUpdated>20210701073016</lastUpdated>
</versioning>
</metadata>
'latest' will evaluate to '1.8.0-dev.7' because of this line:
Line 558 in 971dfb4
| latest_version = max(versionList) |
This is just a string-compare and not a semantic-version comparison.
I think it would make sense to use a library like semver or semantic-version for the comparison.
saltmaster $> salt --version-report
Salt Version:
Salt: 3002.2
Dependency Versions:
cffi: 1.13.2
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: 0.28.4
M2Crypto: 0.35.2
Mako: Not Installed
msgpack: 0.5.6
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.17
pycrypto: Not Installed
pycryptodome: Not Installed
pygit2: 0.28.2
Python: 3.6.13 (default, Mar 10 2021, 18:30:35) [GCC]
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 17.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.3
System Versions:
dist: sles 15.2
locale: UTF-8
machine: x86_64
release: 5.3.18-24.67-default
system: Linux
version: SLES 15.2
Sonatype Nexus Repository Manager in Version OSS 3.30.1-01
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementenhancing, extending functionality, not refactor or net newenhancing, extending functionality, not refactor or net new