From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-21.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FB5DC388F9 for ; Mon, 23 Nov 2020 11:26:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A74AC20720 for ; Mon, 23 Nov 2020 11:26:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GRT7fJwg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A74AC20720 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kh9zf-0001Be-6o for qemu-devel@archiver.kernel.org; Mon, 23 Nov 2020 06:26:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kh9yI-0007nY-DR for qemu-devel@nongnu.org; Mon, 23 Nov 2020 06:25:26 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kh9yF-0004aH-4B for qemu-devel@nongnu.org; Mon, 23 Nov 2020 06:25:26 -0500 Received: by mail-wr1-x434.google.com with SMTP id 23so18184320wrc.8 for ; Mon, 23 Nov 2020 03:25:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eB7R40ZSNFHnuB0T7CKSy384tKsxN5SWBmQnsqr6fkc=; b=GRT7fJwgYMP6M9Te8QBSWmp86uDS1j0/f4q4D+TKdFSfAEn+hghM9bW9fwpoCDJh2k mBLBN1tziJn+B85UV4j/cHHQY17tDNtdl5Jzd5kgsKa05W9O2dtAvqThaGBldbr9FbJa hPzFwAPWIRJVpjo5irH9CzDVxwnMifhaHrTQu5NIXKvLpddNSRk2O9HWFEW2ZSKJj016 RAnmQ+yEmaFzmmcBFDv50MJrKCAwyg3JyAkLO5oUWTOoN+pj/Re6mpkkyI7RYWW6Ko2b F5/yoenAQpKTtda07/k/k5DiqgkfKBih0mkYfeXlROeLZ1Us8L3DbMe3PlB/9c2/p3DJ eruw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eB7R40ZSNFHnuB0T7CKSy384tKsxN5SWBmQnsqr6fkc=; b=TehGitGULiWd7KufXe/G0lhofE7cxCeGRalZTGmPMqzJqW/wv9F8xyI0QHIGb15gB9 24KyTxkyZNWNFr3E23qtwCm5RCp3ITzjefsLwMoP6S8HUbfjH+bJrg3PUwdAueVJ2Ll8 yvIu+QtxjZzYMwpY/RtG6fTE+Mmd+un5TAXUNGhLd0p5JFlkRJjhDygK6cPBGofOoc7L qH0xcewR+FBlmh5eQ4tYm8epE7IEhWmQ5aBlNV5OVK3WkxUP1ZGTuv7zipNuqCJFcW5V mRPuFLi7uQq0N9TwO5hDU+wcbuz4c9X/274Kpxv6NESCPBYPeK+sZXC2MUHOWfpD3oX3 xewA== X-Gm-Message-State: AOAM533/Acza9wS+JoCV4dqzBDyQjXSxcBrdjnf4XvPlhWqD0ztQDWYz UCZ49/qQ0LrxvbNmARyXCEIAlA== X-Google-Smtp-Source: ABdhPJzcQwwxdyPIiTARflt7nsT5Ohllgt516g2Y6zI8Gr71vGkXgI5M0zL7xSGdP1d2ChGjv0FMLg== X-Received: by 2002:a5d:4f10:: with SMTP id c16mr6882418wru.39.1606130720418; Mon, 23 Nov 2020 03:25:20 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f23sm15775140wmb.43.2020.11.23.03.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 03:25:19 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D83611FF87; Mon, 23 Nov 2020 11:25:18 +0000 (GMT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 1/7] scripts/ci: clean up default args logic a little Date: Mon, 23 Nov 2020 11:25:12 +0000 Message-Id: <20201123112518.13425-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201123112518.13425-1-alex.bennee@linaro.org> References: <20201123112518.13425-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-devel@nongnu.org, Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20201117173635.29101-2-alex.bennee@linaro.org> 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