deploy: support GitLab Job Artifacts as a mirror

This commit is contained in:
Hans-Christoph Steiner 2022-11-15 14:37:08 +01:00
parent d0976a3684
commit 947d94e0a9
No known key found for this signature in database
GPG key ID: 3E177817BA1B9BFA
2 changed files with 47 additions and 7 deletions

View file

@ -1453,6 +1453,26 @@ def get_mirror_service_urls(url):
# GitLab Raw "https://gitlab.com/user/repo/-/raw/branch/folder"
gitlab_raw = segments + ['-', 'raw', branch, folder]
urls.append('/'.join(gitlab_raw))
# GitLab Artifacts "https://user.gitlab.io/-/repo/-/jobs/job_id/artifacts/public/folder"
job_id = os.getenv('CI_JOB_ID')
try:
int(job_id)
gitlab_artifacts = [
"https:",
"",
user + ".gitlab.io",
'-',
repo,
'-',
'jobs',
job_id,
'artifacts',
'public',
folder,
]
urls.append('/'.join(gitlab_artifacts))
except (TypeError, ValueError):
pass # no Job ID to use, ignore
return urls