I'd like to grab the associated registry repositories and tags for a gitlab project. Right now my code attempts to do this for a single project but later I'll have to scale this for multiple projects and update as the tags are updated.
Here's my code but I don't get the registries out as expected, instead a 404 error.
# private token authentication
parser = argparse.ArgumentParser()
parser.add_argument("--token","-t",help="Gitlab token used to login")
args = parser.parse_args()
if not args.token:
raise ValueError("No gitlab token specified")
gl = gitlab.Gitlab('https://gitlab.abcdef.com', private_token=args.token)
project = gl.projects.get('https://gitlab.abcdef.com/xyz/reflection')
repositories = project.repositories.list()
repository = repositories.pop()
tags = repository.tags.list()
print(tags)
I tried it out by looking at the examples here: https://python-gitlab.readthedocs.io/en/stable/gl_objects/repository_tags.html
What am I doing incorrect? How can I get a list out. Thanks so much for any help!
Update: I got this to work using project_id , however I'd ideally like it to work using project name or url as I need to loop through and grab registries and tags for a number of gitlab projects.
# private token authentication
parser = argparse.ArgumentParser()
parser.add_argument("--token","-t",help="Gitlab token used to login")
args = parser.parse_args()
if not args.token:
raise ValueError("No gitlab token specified")
gl = gitlab.Gitlab('https://gitlab.abcdef.com', private_token=args.token)
project_id = 85
project = gl.projects.get(project_id)
repositories = project.repositories.list()
repository = repositories.pop()
tags = repository.tags.list()
print(repositories)
print(tags)
I get a list of tags and registry repositories.