Commit e5691607 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rf/version' into 'master'

MNT: Get project tags from gitlab, as local clones may not have full history

See merge request fsl/conda/manifest-rules!14
parents bf5ea56b eeecaf4c
#!/usr/bin/env python #!/usr/bin/env python
__version__ = '0.3.10' __version__ = '0.3.11'
...@@ -20,6 +20,8 @@ import urllib.request as urlrequest ...@@ -20,6 +20,8 @@ import urllib.request as urlrequest
import yaml import yaml
import dateutil.parser as dateutil import dateutil.parser as dateutil
from fsl_ci.gitlab import lookup_project_tags
def sprun(cmd, **kwargs): def sprun(cmd, **kwargs):
"""Runs the given command with subprocess.run, returning its standard """Runs the given command with subprocess.run, returning its standard
...@@ -80,8 +82,20 @@ def get_most_recent_release(): ...@@ -80,8 +82,20 @@ def get_most_recent_release():
if p1 > p2: return False if p1 > p2: return False
return len(self.components) < len(other.components) return len(self.components) < len(other.components)
tags = sprun('git tag --list', text=True).split('\n') # get tag list from gitlab if possible
tags = [t.strip() for t in tags] project = os.environ.get('CI_PROJECT_PATH', None)
server = os.environ.get('CI_SERVER_URL', None)
token = os.environ.get('CI_JOB_TOKEN', None)
if all ((project is not None,
server is not None,
token is not None)):
tags = lookup_project_tags(project, server, token)
else:
tags = sprun('git tag --list', text=True).split('\n')
tags = [t.strip() for t in tags]
tags = [Version(t) for t in tags if t != ''] tags = [Version(t) for t in tags if t != '']
tags = sorted(tags) tags = sorted(tags)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment