mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
gitlab: manifest: Use a cerbero ref with build
For non-cerbero builds, pick a cerbero reference for which a build has completed. This will reduce the number of cache miss, hence reduce the number of timeouts and slow build we are facing each time cerbero is updated. Fixes #16
This commit is contained in:
parent
a659ed8f2e
commit
1e27cc81b1
1 changed files with 28 additions and 2 deletions
|
@ -2,12 +2,14 @@
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import requests
|
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import urllib.error
|
||||||
|
import urllib.parse
|
||||||
|
import urllib.request
|
||||||
|
import json
|
||||||
|
|
||||||
from typing import Dict, Tuple, List
|
from typing import Dict, Tuple, List
|
||||||
from urllib.parse import urlparse
|
|
||||||
# from pprint import pprint
|
# from pprint import pprint
|
||||||
|
|
||||||
GSTREAMER_MODULES: List[str] = [
|
GSTREAMER_MODULES: List[str] = [
|
||||||
|
@ -44,6 +46,23 @@ os.environ['GIT_TERMINAL_PROMPT'] = '0'
|
||||||
def git(*args, repository_path='.'):
|
def git(*args, repository_path='.'):
|
||||||
return subprocess.check_output(["git"] + list(args), cwd=repository_path).decode()
|
return subprocess.check_output(["git"] + list(args), cwd=repository_path).decode()
|
||||||
|
|
||||||
|
def get_cerbero_last_build_info (namespace : str, branch : str):
|
||||||
|
base_url = f"https://gitlab.freedesktop.org/{namespace}/cerbero/-/jobs"
|
||||||
|
url = f"{base_url}/artifacts/{branch}/raw/cerbero-build/cerbero-deps.log"
|
||||||
|
deps = [{'commit': None}]
|
||||||
|
|
||||||
|
try:
|
||||||
|
# The logs are only available if all jobs have passed so it does not
|
||||||
|
# matter which distro/arch is picked.
|
||||||
|
values = { 'job': "cerbero deps fedora x86_64" }
|
||||||
|
data = urllib.parse.urlencode(values)
|
||||||
|
req = urllib.request.Request(f"{url}?{data}")
|
||||||
|
resp = urllib.request.urlopen(req);
|
||||||
|
deps = json.loads(resp.read())
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
return deps[0]['commit']
|
||||||
|
|
||||||
def get_branches_info(module: str, namespace: str, branches: List[str]) -> Tuple[str, str]:
|
def get_branches_info(module: str, namespace: str, branches: List[str]) -> Tuple[str, str]:
|
||||||
try:
|
try:
|
||||||
|
@ -54,6 +73,13 @@ def get_branches_info(module: str, namespace: str, branches: List[str]) -> Tuple
|
||||||
if not res:
|
if not res:
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
# Special case cerbero to avoid cache misses
|
||||||
|
if module == 'cerbero':
|
||||||
|
for branch in branches:
|
||||||
|
sha = get_cerbero_last_build_info(namespace, branch)
|
||||||
|
if sha is not None:
|
||||||
|
return sha, sha
|
||||||
|
|
||||||
lines = res.split('\n')
|
lines = res.split('\n')
|
||||||
for branch in branches:
|
for branch in branches:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
|
|
Loading…
Reference in a new issue