2022-11-18 21:12:21 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2018-07-21 20:28:37 +00:00
|
|
|
import gitlab
|
|
|
|
|
|
|
|
TOKEN = "CHANGEME"
|
|
|
|
CLEAN_BEFORE = "2018-07"
|
2018-12-10 15:00:33 +00:00
|
|
|
gl = gitlab.Gitlab("https://dev.funkwhale.audio", private_token=TOKEN, per_page=100)
|
2018-07-21 20:28:37 +00:00
|
|
|
project = gl.projects.get("funkwhale/funkwhale")
|
|
|
|
|
|
|
|
jobs = project.jobs.list(as_list=False)
|
|
|
|
total = jobs.total
|
|
|
|
|
|
|
|
for job in jobs:
|
|
|
|
if job.attributes["ref"] != "develop":
|
|
|
|
continue
|
|
|
|
if job.attributes["status"] != "success":
|
|
|
|
continue
|
|
|
|
if job.attributes["tag"] is True:
|
|
|
|
continue
|
|
|
|
if job.attributes["name"] not in ["build_api", "build_front", "pages"]:
|
|
|
|
continue
|
|
|
|
if job.attributes["created_at"].startswith(CLEAN_BEFORE):
|
|
|
|
continue
|
|
|
|
relevant = {
|
|
|
|
"ref": job.attributes["ref"],
|
|
|
|
"status": job.attributes["status"],
|
|
|
|
"tag": job.attributes["tag"],
|
|
|
|
"name": job.attributes["name"],
|
|
|
|
"created_at": job.attributes["created_at"],
|
|
|
|
}
|
2022-11-23 21:36:56 +00:00
|
|
|
print(f"Deleting job {job.id}!", relevant)
|
2018-07-21 20:28:37 +00:00
|
|
|
job.erase()
|