[Qa-jenkins-scm] [jenkins.debian.net] 06/07: chroot-run: support exporting build results out of the chroot
Holger Levsen
holger at layer-acht.org
Thu May 18 00:06:58 UTC 2017
This is an automated email from the git hooks/post-receive script.
holger pushed a commit to branch master
in repository jenkins.debian.net.
commit 13a8518d321a47199cdf39ae3d182392679c48a1
Author: Mattia Rizzolo <mattia at debian.org>
Date: Wed May 17 10:47:44 2017 +0200
chroot-run: support exporting build results out of the chroot
Thanks: Niels Thykier for the original patch!
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
bin/chroot-run.sh | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/bin/chroot-run.sh b/bin/chroot-run.sh
index 813ef56..c26d3bb 100755
--- a/bin/chroot-run.sh
+++ b/bin/chroot-run.sh
@@ -8,6 +8,10 @@ DEBUG=true
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
+EXPORTS_RESULTS=false
+# Inside chroot (for the job process)
+JENKINS_EXPORTS_DIR=/tmp/job-exports
+
# cp artifacts back into workspace if this is set
if [ "$ARTIFACTS" != "true" ] ; then
ARTIFACTS=false
@@ -17,7 +21,7 @@ fi
# $2 $3 ... = command to run inside a clean chroot running the distro in $1
if [ $# -lt 2 ]; then
- echo "usage: $0 DISTRO [backports|minimal] CMD [ARG1 ARG2 ...]"
+ echo "usage: $0 DISTRO [backports|minimal] [--exports-results] CMD [ARG1 ARG2 ...]"
exit 1
fi
@@ -36,6 +40,12 @@ if [ "$1" = "minimal" ] ; then
shift
fi
+if [ "$1" = "--exports-results" ]; then
+ EXPORTS_RESULTS=true
+ export JENKINS_EXPORTS_DIR
+ shift
+fi
+
if [ ! -d "$CHROOT_BASE" ]; then
echo "Directory $CHROOT_BASE does not exist, aborting."
exit 1
@@ -73,6 +83,11 @@ bootstrap() {
fi
fi
+ if [ "$EXPORTS_RESULTS" = "true" ]; then
+ mkdir -p "$CHROOT_TARGET/$JENKINS_EXPORTS_DIR"
+ fi
+
+
cat > $CHROOT_TARGET/tmp/chroot-prepare <<-EOF
$SCRIPT_HEADER
mount /proc -t proc /proc
@@ -96,6 +111,15 @@ cleanup() {
cp -v $CHROOT_TARGET/tmp/testrun/stats.csv $CURDIR
fi
+ if [ "${EXPORTS_RESULTS}" = "true" ]; then
+ mkdir -p "$WORKSPACE/job-exports"
+ if [ ! -z "$(ls -1A "$CHROOT_TARGET/$JENKINS_EXPORTS_DIR")" ]; then
+ cp -drv "$CHROOT_TARGET/$JENKINS_EXPORTS_DIR"/* "$WORKSPACE/job-exports/"
+ else
+ echo "W: No exported results found in $JENKINS_EXPORTS_DIR"
+ fi
+ fi
+
#
# special case: publish debian-edu-doc on the webserver
#
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git
More information about the Qa-jenkins-scm
mailing list