gitlab-test/app/languages.py

25 lines
580 B
Python
Raw Normal View History

2022-05-21 21:59:10 +00:00
#!/usr/bin/env python3
import gitlab
import os
def getProject(client, project_name):
return client.projects.get(project_name)
def getLanguage(project):
return list(project.languages().items())
def helmSet(lang):
ret = ''
for i in range(len(lang)):
ret += f"--set global.language[{i}]={lang[i][0]}"
return ret
if __name__ == '__main__':
with gitlab.Gitlab(url=os.environ['GITLAB_URL'], private_token=os.environ['GITLAB_TOKEN'], user_agent='my-package/1.0.0') as gl:
print(helmSet(getLanguage(getProject(gl, 'root/test'))), end=" ")