[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/23] scripts/ci/gitlab-pipeline-status: make branch name configu
From: |
Thomas Huth |
Subject: |
[PULL 17/23] scripts/ci/gitlab-pipeline-status: make branch name configurable |
Date: |
Tue, 13 Oct 2020 12:55:21 +0200 |
From: Cleber Rosa <crosa@redhat.com>
With the utility function `get_local_staging_branch_commit()`, the
name of the branch is hard coded (including in the function name).
For extensibility reasons, let's make that configurable.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20200904164258.240278-2-crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
scripts/ci/gitlab-pipeline-status | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/ci/gitlab-pipeline-status
b/scripts/ci/gitlab-pipeline-status
index 348a49b6a4..194dd4d0bb 100755
--- a/scripts/ci/gitlab-pipeline-status
+++ b/scripts/ci/gitlab-pipeline-status
@@ -23,20 +23,20 @@ import time
import sys
-def get_local_staging_branch_commit():
+def get_local_branch_commit(branch='staging'):
"""
Returns the commit sha1 for the *local* branch named "staging"
"""
- result = subprocess.run(['git', 'rev-parse', 'staging'],
+ result = subprocess.run(['git', 'rev-parse', branch],
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
cwd=os.path.dirname(__file__),
universal_newlines=True).stdout.strip()
- if result == 'staging':
- raise ValueError("There's no local branch named 'staging'")
+ if result == branch:
+ raise ValueError("There's no local branch named '%s'" % branch)
if len(result) != 40:
- raise ValueError("Branch staging HEAD doesn't look like a sha1")
+ raise ValueError("Branch '%s' HEAD doesn't look like a sha1" % branch)
return result
@@ -110,7 +110,7 @@ def main():
'for https://gitlab.com/qemu-project/qemu, that '
'is, "%(default)s"'))
try:
- default_commit = get_local_staging_branch_commit()
+ default_commit = get_local_branch_commit()
commit_required = False
except ValueError:
default_commit = ''
--
2.18.2
- [PULL 13/23] configure: fixes indent of $meson setup, (continued)
- [PULL 13/23] configure: fixes indent of $meson setup, Thomas Huth, 2020/10/13
- [PULL 12/23] docs/system/deprecated: Mark the 'moxie' CPU as deprecated, Thomas Huth, 2020/10/13
- [PULL 09/23] Add a comment in bios-tables-test.c to clarify the reason behind approach, Thomas Huth, 2020/10/13
- [PULL 10/23] MAINTAINERS: Ignore bios-tables-test in the qtest section, Thomas Huth, 2020/10/13
- [PULL 11/23] Remove superfluous .gitignore files, Thomas Huth, 2020/10/13
- [PULL 15/23] gitlab: add a CI job to validate the DCO sign off, Thomas Huth, 2020/10/13
- [PULL 07/23] tests/migration: Allow longer timeouts, Thomas Huth, 2020/10/13
- [PULL 14/23] gitlab: add a CI job for running checkpatch.pl, Thomas Huth, 2020/10/13
- [PULL 16/23] gitlab: assign python helper files to GitLab maintainers section, Thomas Huth, 2020/10/13
- [PULL 18/23] scripts/ci/gitlab-pipeline-status: improve message regarding timeout, Thomas Huth, 2020/10/13
- [PULL 17/23] scripts/ci/gitlab-pipeline-status: make branch name configurable,
Thomas Huth <=
- [PULL 20/23] scripts/ci/gitlab-pipeline-status: refactor parser creation, Thomas Huth, 2020/10/13
- [PULL 21/23] scripts/ci/gitlab-pipeline-status: handle keyboard interrupts, Thomas Huth, 2020/10/13
- [PULL 19/23] scripts/ci/gitlab-pipeline-status: give early feedback on running pipelines, Thomas Huth, 2020/10/13
- [PULL 23/23] scripts/ci/gitlab-pipeline-status: wait for pipeline creation, Thomas Huth, 2020/10/13
- [PULL 22/23] scripts/ci/gitlab-pipeline-status: use more descriptive exceptions, Thomas Huth, 2020/10/13
- Re: [PULL 00/23] qtests, gitlab-CI and misc patches, Peter Maydell, 2020/10/13