mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +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
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from typing import Dict, Tuple, List
|
from typing import Dict, Tuple, List
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -243,17 +245,33 @@ def test_find_repository_sha():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
projects: str = ''
|
parser = argparse.ArgumentParser()
|
||||||
project_template: str = " <project name=\"{}\" remote=\"{}\" revision=\"{}\" />\n"
|
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'])
|
user_remote_url: str = os.path.dirname(os.environ['CI_PROJECT_URL'])
|
||||||
if not user_remote_url.endswith('/'):
|
if not user_remote_url.endswith('/'):
|
||||||
user_remote_url += '/'
|
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:
|
for module in GSTREAMER_MODULES:
|
||||||
print(f"Checking {module}:", end=' ')
|
print(f"Checking {module}:", end=' ')
|
||||||
current_branch: str = os.environ['CI_COMMIT_REF_NAME']
|
|
||||||
remote, revision = find_repository_sha(module, current_branch)
|
remote, revision = find_repository_sha(module, current_branch)
|
||||||
projects += project_template.format(module[0], remote, revision)
|
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)
|
print(MANIFEST_TEMPLATE.format(user_remote_url, projects), file=manifest)
|
||||||
|
|
|
@ -6,13 +6,13 @@ variables:
|
||||||
GIT_STRATEGY: none
|
GIT_STRATEGY: none
|
||||||
|
|
||||||
manifest:
|
manifest:
|
||||||
image: "fedora"
|
image: registry.freedesktop.org/gstreamer/gst-ci/amd64/alpine-manifest-build:latest
|
||||||
stage: "manifest"
|
stage: "manifest"
|
||||||
script:
|
script:
|
||||||
- dnf install -y python3-requests
|
- cd /gst-ci
|
||||||
- curl -o build_manifest.py https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/build_manifest.py
|
- gitlab/build_manifest.py --self-update
|
||||||
- python3 build_manifest.py
|
- gitlab/build_manifest.py ${CI_PROJECT_DIR}/manifest.xml
|
||||||
- cat manifest.xml
|
- cat ${CI_PROJECT_DIR}/manifest.xml
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: "2 days"
|
expire_in: "2 days"
|
||||||
paths:
|
paths:
|
||||||
|
|
Loading…
Reference in a new issue