1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

maven_artifact: Adjust path for time stamped SNAPSHOT versions (#713)

* Adjust path for time stamped SNAPSHOT versions

Test the version string for the timestamp SNAPSHOT pattern. If it matches, substitute the SNAPSHOT version in the artifact path rather than the timestamped version string.

* Add changelog fragment for PR 713

* Update changelogs/fragments/713-maven-timestamp-snapshot.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* C
Fix problems reported by shippable
Fix problems reported by pull request checks

* Resolve additional shipping errors

Co-authored-by: jweber <jweber@seastreet.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
John Weber 2020-11-16 15:41:55 -05:00 committed by GitHub
parent 5cc900cfdb
commit 9787e8a6bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "maven_artifact - handle timestamped snapshot version strings properly (https://github.com/ansible-collections/community.general/issues/709)."

View file

@ -215,6 +215,7 @@ import shutil
import io
import tempfile
import traceback
import re
from ansible.module_utils.ansible_release import __version__ as ansible_version
from re import match
@ -307,7 +308,11 @@ class Artifact(object):
def path(self, with_version=True):
base = posixpath.join(self.group_id.replace(".", "/"), self.artifact_id)
if with_version and self.version:
base = posixpath.join(base, self.version)
timestamp_version_match = re.match("^(.*-)?([0-9]{8}\\.[0-9]{6}-[0-9]+)$", self.version)
if timestamp_version_match:
base = posixpath.join(base, timestamp_version_match.group(1) + "SNAPSHOT")
else:
base = posixpath.join(base, self.version)
return base
def _generate_filename(self):