[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 008/115] run-coverity-scan: support --update-tools-only --docker
From: |
Paolo Bonzini |
Subject: |
[PULL 008/115] run-coverity-scan: support --update-tools-only --docker |
Date: |
Thu, 11 Jun 2020 15:43:02 -0400 |
Just build the container when run-coverity-scan is invoked with
--update-tools-only --docker. This requires moving the "docker build"
logic into the update_coverity_tools function.
The only snag is that --update-tools-only --docker requires access to
the dockerfile. For now just report an error for --src-tarball, and
"docker build" will fail if not in a source tree. Another possibility
could be to host our container images on a public registry, and use
"FROM qemu:fedora" to make the Dockerfile small enough that it can be
included directly in the run-coverity-scan script.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/coverity-scan/run-coverity-scan | 39 +++++++++++++++----------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/scripts/coverity-scan/run-coverity-scan
b/scripts/coverity-scan/run-coverity-scan
index 8bff952bf5..03a791dec9 100755
--- a/scripts/coverity-scan/run-coverity-scan
+++ b/scripts/coverity-scan/run-coverity-scan
@@ -95,6 +95,18 @@ check_upload_permissions() {
}
+build_docker_image() {
+ # build docker container including the coverity-scan tools
+ echo "Building docker container..."
+ # TODO: This re-unpacks the tools every time, rather than caching
+ # and reusing the image produced by the COPY of the .tgz file.
+ # Not sure why.
+ tests/docker/docker.py --engine ${DOCKER_ENGINE} build \
+ -t coverity-scanner -f
scripts/coverity-scan/coverity-scan.docker \
+ --extra-files scripts/coverity-scan/run-coverity-scan \
+ "$COVERITY_TOOL_BASE"/coverity_tool.tgz
+}
+
update_coverity_tools () {
# Check for whether we need to download the Coverity tools
# (either because we don't have a copy, or because it's out of date)
@@ -128,6 +140,11 @@ update_coverity_tools () {
fi
fi
rm -f coverity_tool.md5.new
+ cd "$SRCDIR"
+
+ if [ "$DOCKER" = yes ]; then
+ build_docker_image
+ fi
}
@@ -252,15 +269,16 @@ fi
PROJNAME=QEMU
TARBALL=cov-int.tar.xz
-if [ "$UPDATE" = only ] && [ "$DOCKER" = yes ]; then
- echo "Combining --docker and --update-only is not supported"
- exit 1
-fi
-
if [ "$UPDATE" = only ]; then
# Just do the tools update; we don't need to check whether
# we are in a source tree or have upload rights for this,
# so do it before some of the command line and source tree checks.
+
+ if [ "$DOCKER" = yes ] && [ ! -z "$SRCTARBALL" ]; then
+ echo --update-tools-only --docker is incompatible with --src-tarball.
+ exit 1
+ fi
+
update_coverity_tools
exit 0
fi
@@ -322,17 +340,6 @@ if [ "$DOCKER" = yes ]; then
echo "Created temporary directory $SECRETDIR"
SECRET="$SECRETDIR/token"
echo "$COVERITY_TOKEN" > "$SECRET"
- if [ "$UPDATE" != no ]; then
- # build docker container including the coverity-scan tools
- echo "Building docker container..."
- # TODO: This re-unpacks the tools every time, rather than caching
- # and reusing the image produced by the COPY of the .tgz file.
- # Not sure why.
- tests/docker/docker.py --engine ${DOCKER_ENGINE} build \
- -t coverity-scanner -f
scripts/coverity-scan/coverity-scan.docker \
- --extra-files scripts/coverity-scan/run-coverity-scan \
- "$COVERITY_TOOL_BASE"/coverity_tool.tgz
- fi
echo "Archiving sources to be analyzed..."
./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz"
ARGS="--no-update-tools"
--
2.26.2
- [PULL 000/115] Huge miscellaneous pull request for 2020-06-11, Paolo Bonzini, 2020/06/11
- [PULL 008/115] run-coverity-scan: support --update-tools-only --docker,
Paolo Bonzini <=
- [PULL 002/115] docker.py/build: support binary files in --extra-files, Paolo Bonzini, 2020/06/11
- [PULL 004/115] run-coverity-scan: use docker.py, Paolo Bonzini, 2020/06/11
- [PULL 001/115] docker.py/build: support -t and -f arguments, Paolo Bonzini, 2020/06/11
- [PULL 011/115] icount: fix shift=auto for record/replay, Paolo Bonzini, 2020/06/11
- [PULL 007/115] run-coverity-scan: download tools outside the container, Paolo Bonzini, 2020/06/11
- [PULL 006/115] run-coverity-scan: use --no-update-tools in docker run, Paolo Bonzini, 2020/06/11
- [PULL 003/115] run-coverity-scan: get Coverity token and email from special git config section, Paolo Bonzini, 2020/06/11
- [PULL 010/115] numa: prevent usage of -M memory-backend and -numa memdev at the same time, Paolo Bonzini, 2020/06/11
- [PULL 016/115] Makefile: Let the 'help' target list the helper targets, Paolo Bonzini, 2020/06/11
- [PULL 015/115] io/task: Move 'qom/object.h' header to source, Paolo Bonzini, 2020/06/11