qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, "Thomas Huth" <thuth@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH  v1 10/10] scripts/ci: clean up default args logic a little
Date: Tue, 10 Nov 2020 19:23:16 +0000	[thread overview]
Message-ID: <20201110192316.26397-11-alex.bennee@linaro.org> (raw)
In-Reply-To: <20201110192316.26397-1-alex.bennee@linaro.org>

This allows us to do:

  ./scripts/ci/gitlab-pipeline-status -w -b HEAD -p 2961854

to check out own pipeline status of a recently pushed branch.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 scripts/ci/gitlab-pipeline-status | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/scripts/ci/gitlab-pipeline-status b/scripts/ci/gitlab-pipeline-status
index bac8233079..78e72f6008 100755
--- a/scripts/ci/gitlab-pipeline-status
+++ b/scripts/ci/gitlab-pipeline-status
@@ -31,7 +31,7 @@ class NoPipelineFound(Exception):
     """Communication is successfull but pipeline is not found."""
 
 
-def get_local_branch_commit(branch='staging'):
+def get_local_branch_commit(branch):
     """
     Returns the commit sha1 for the *local* branch named "staging"
     """
@@ -126,18 +126,16 @@ def create_parser():
                         help=('The GitLab project ID. Defaults to the project '
                               'for https://gitlab.com/qemu-project/qemu, that '
                               'is, "%(default)s"'))
-    try:
-        default_commit = get_local_branch_commit()
-        commit_required = False
-    except ValueError:
-        default_commit = ''
-        commit_required = True
-    parser.add_argument('-c', '--commit', required=commit_required,
-                        default=default_commit,
+    parser.add_argument('-b', '--branch', type=str, default="staging",
+                        help=('Specify the branch to check. '
+                              'Use HEAD for your current branch. '
+                              'Otherwise looks at "%(default)s"'))
+    parser.add_argument('-c', '--commit',
+                        default=None,
                         help=('Look for a pipeline associated with the given '
                               'commit.  If one is not explicitly given, the '
-                              'commit associated with the local branch named '
-                              '"staging" is used.  Default: %(default)s'))
+                              'commit associated with the default branch '
+                              'is used.'))
     parser.add_argument('--verbose', action='store_true', default=False,
                         help=('A minimal verbosity level that prints the '
                               'overall result of the check/wait'))
@@ -149,6 +147,10 @@ def main():
     """
     parser = create_parser()
     args = parser.parse_args()
+
+    if not args.commit:
+        args.commit = get_local_branch_commit(args.branch)
+
     success = False
     try:
         if args.wait:
-- 
2.20.1



  parent reply	other threads:[~2020-11-10 19:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 19:23 [PATCH v1 for 5.1 00/10] various fixes (CI, Xen, plugins) Alex Bennée
2020-11-10 19:23 ` [PATCH v1 01/10] plugins: Fix resource leak in connect_socket() Alex Bennée
2020-11-10 19:23 ` [PATCH v1 02/10] plugins: Fix two resource leaks in setup_socket() Alex Bennée
2020-11-10 19:23 ` [PATCH v1 03/10] meson.build: fix building of Xen support for aarch64 Alex Bennée
2020-11-10 19:23 ` [PATCH v1 04/10] include/hw/xen.h: drop superfluous struct Alex Bennée
2020-11-10 19:23 ` [PATCH v1 05/10] stubs/xen-hw-stub: drop xenstore_store_pv_console_info stub Alex Bennée
2020-11-10 19:23 ` [PATCH v1 06/10] accel/stubs: drop unused cpu.h include Alex Bennée
2020-11-10 19:23 ` [PATCH v1 07/10] hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off Alex Bennée
2020-11-11 11:52   ` Igor Mammedov
2020-11-10 19:23 ` [PATCH v1 08/10] tests/acceptance: Disable Spartan-3A DSP 1800A test Alex Bennée
2020-11-10 19:23 ` [PATCH v1 09/10] gitlab: move remaining x86 check-tcg targets to gitlab Alex Bennée
2020-11-10 19:23 ` Alex Bennée [this message]
2020-11-10 22:50 ` [PATCH v1 for 5.1 00/10] various fixes (CI, Xen, plugins) Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201110192316.26397-11-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).