From: Thibault Saunier Date: Sun, 11 Nov 2018 12:33:13 +0000 (-0300) Subject: gitlab: Handle checking out the right gst-ci branch to call build_manifest X-Git-Tag: 1.19.3~497^2~522 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cfe2cee41c7bf7186953a8a603d956af1d8ebb1;p=platform%2Fupstream%2Fgstreamer.git gitlab: Handle checking out the right gst-ci branch to call build_manifest --- diff --git a/gitlab/build_manifest.py b/gitlab/build_manifest.py index 669c4dd..a0bac12 100755 --- a/gitlab/build_manifest.py +++ b/gitlab/build_manifest.py @@ -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 = " \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 = " \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) diff --git a/gitlab/ci_template.yml b/gitlab/ci_template.yml index 9118ad2..6556f47 100644 --- a/gitlab/ci_template.yml +++ b/gitlab/ci_template.yml @@ -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: