From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, berrange@redhat.com
Subject: Re: [PATCH 1/2] run-coverity-scan: add --check-upload-only option
Date: Thu, 7 Mar 2024 12:47:38 +0000 [thread overview]
Message-ID: <CAFEAcA9fbCT=i2b0KnZW1HDb5giCxsehvVbMK4-+RYpCX_yoOQ@mail.gmail.com> (raw)
In-Reply-To: <20240305190902.364753-2-pbonzini@redhat.com>
On Tue, 5 Mar 2024 at 19:09, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Add an option to check if upload is permitted without actually
> attempting a build. This can be useful to add a third outcome
> beyond success and failure---namely, a CI job can self-cancel
> if the uploading quota has been reached.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> scripts/coverity-scan/run-coverity-scan | 51 ++++++++++++++++++-------
> 1 file changed, 38 insertions(+), 13 deletions(-)
>
> diff --git a/scripts/coverity-scan/run-coverity-scan b/scripts/coverity-scan/run-coverity-scan
> index d56c9b66776..4bc991f70fd 100755
> --- a/scripts/coverity-scan/run-coverity-scan
> +++ b/scripts/coverity-scan/run-coverity-scan
> @@ -28,6 +28,7 @@
> # project settings, if you have maintainer access there.
>
> # Command line options:
> +# --check-upload-only : return success if upload is possible
> # --dry-run : run the tools, but don't actually do the upload
> # --docker : create and work inside a container
> # --docker-engine : specify the container engine to use (docker/podman/auto);
> @@ -57,18 +58,18 @@
> # putting it in a file and using --tokenfile. Everything else has
> # a reasonable default if this is run from a git tree.
>
> -check_upload_permissions() {
> +upload_permitted() {
> # Check whether we can do an upload to the server; will exit the script
> # with status 1 if the check failed (usually a bad token);
This comment says we exit with status 1 on a failed check...
> # will exit the script with status 0 if the check indicated that we
> # can't upload yet (ie we are at quota)
> - # Assumes that COVERITY_TOKEN, PROJNAME and DRYRUN have been initialized.
> + # Assumes that COVERITY_TOKEN and PROJNAME have been initialized.
>
> echo "Checking upload permissions..."
>
> if ! up_perm="$(wget https://scan.coverity.com/api/upload_permitted --post-data "token=$COVERITY_TOKEN&project=$PROJNAME" -q -O -)"; then
> echo "Coverity Scan API access denied: bad token?"
> - exit 1
> + exit 99
...but these changes switch to exit 99 instead. It's not clear to
me why -- the commit message doesn't say anything about changing
the exit status.
> fi
>
> # Really up_perm is a JSON response with either
Otherwise this looks OK.
thanks
-- PMM
next prev parent reply other threads:[~2024-03-07 12:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 19:09 [PATCH 0/2] ci: allow running Coverity Scan uploads via GitLab Paolo Bonzini
2024-03-05 19:09 ` [PATCH 1/2] run-coverity-scan: add --check-upload-only option Paolo Bonzini
2024-03-07 12:47 ` Peter Maydell [this message]
2024-03-05 19:09 ` [PATCH 2/2] gitlab-ci: add manual job to run Coverity Paolo Bonzini
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='CAFEAcA9fbCT=i2b0KnZW1HDb5giCxsehvVbMK4-+RYpCX_yoOQ@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).