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

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

parent bf5ea56b
#!/usr/bin/env python
__version__ = '0.3.10'
__version__ = '0.3.11'
......@@ -20,6 +20,8 @@ import urllib.request as urlrequest
import yaml
import dateutil.parser as dateutil
from fsl_ci.gitlab import lookup_project_tags
def sprun(cmd, **kwargs):
"""Runs the given command with subprocess.run, returning its standard
......@@ -80,8 +82,20 @@ def get_most_recent_release():
if p1 > p2: return False
return len(self.components) < len(other.components)
tags = sprun('git tag --list', text=True).split('\n')
tags = [t.strip() for t in tags]
# get tag list from gitlab if possible
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 = sorted(tags)
......
Markdown is supported
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