mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
gitlab: Handle checking out the right gst-ci branch to call build_manifest
This commit is contained in:
parent
7ede1f54aa
commit
0cfe2cee41
2 changed files with 27 additions and 9 deletions
|
@ -1,8 +1,10 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import requests
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from typing import Dict, Tuple, List
|
||||
from urllib.parse import urlparse
|
||||
|
@ -243,17 +245,33 @@ def test_find_repository_sha():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
projects: str = ''
|
||||
project_template: str = " <project name=\"{}\" remote=\"{}\" revision=\"{}\" />\n"
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--self-update", action="store_true", default=False)
|
||||
parser.add_argument(dest="output", default='manifest.xml', nargs='?')
|
||||
options = parser.parse_args()
|
||||
|
||||
current_branch: str = os.environ['CI_COMMIT_REF_NAME']
|
||||
user_remote_url: str = os.path.dirname(os.environ['CI_PROJECT_URL'])
|
||||
if not user_remote_url.endswith('/'):
|
||||
user_remote_url += '/'
|
||||
|
||||
if options.self_update:
|
||||
remote, sha = find_repository_sha(("gst-ci", "1343"), current_branch)
|
||||
if remote == 'user':
|
||||
remote = user_remote_url + 'gst-ci'
|
||||
else:
|
||||
remote = "https://gitlab.freedesktop.org/gstreamer/gst-ci"
|
||||
|
||||
subprocess.check_call(['git', 'fetch', remote, sha])
|
||||
subprocess.check_call(['git', 'checkout', '--detach', 'FETCH_HEAD'])
|
||||
sys.exit(0)
|
||||
|
||||
projects: str = ''
|
||||
project_template: str = " <project name=\"{}\" remote=\"{}\" revision=\"{}\" />\n"
|
||||
for module in GSTREAMER_MODULES:
|
||||
print(f"Checking {module}:", end=' ')
|
||||
current_branch: str = os.environ['CI_COMMIT_REF_NAME']
|
||||
remote, revision = find_repository_sha(module, current_branch)
|
||||
projects += project_template.format(module[0], remote, revision)
|
||||
|
||||
with open('manifest.xml', mode='w') as manifest:
|
||||
with open(options.output, mode='w') as manifest:
|
||||
print(MANIFEST_TEMPLATE.format(user_remote_url, projects), file=manifest)
|
||||
|
|
|
@ -6,13 +6,13 @@ variables:
|
|||
GIT_STRATEGY: none
|
||||
|
||||
manifest:
|
||||
image: "fedora"
|
||||
image: registry.freedesktop.org/gstreamer/gst-ci/amd64/alpine-manifest-build:latest
|
||||
stage: "manifest"
|
||||
script:
|
||||
- dnf install -y python3-requests
|
||||
- curl -o build_manifest.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/build_manifest.py
|
||||
- python3 build_manifest.py
|
||||
- cat manifest.xml
|
||||
- cd /gst-ci
|
||||
- gitlab/build_manifest.py --self-update
|
||||
- gitlab/build_manifest.py ${CI_PROJECT_DIR}/manifest.xml
|
||||
- cat ${CI_PROJECT_DIR}/manifest.xml
|
||||
artifacts:
|
||||
expire_in: "2 days"
|
||||
paths:
|
||||
|
|
Loading…
Reference in a new issue