[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 8 commits: reproducible debian: build.sh: drop handling of the "version mismatch between…
Mattia Rizzolo
gitlab at salsa.debian.org
Tue Jun 19 16:19:31 BST 2018
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
0470f48c by Mattia Rizzolo at 2018-06-19T17:17:31+02:00
reproducible debian: build.sh: drop handling of the "version mismatch between master and build node", that is not possible anymore
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
c94aea7c by Mattia Rizzolo at 2018-06-19T17:17:41+02:00
reproducible debian: build.sh: let the cleanup be implied by the trap
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
fda61fc7 by Mattia Rizzolo at 2018-06-19T17:17:43+02:00
reproducible debian: build.sh: change the way ftbfs are handled
now the remote process will return an appropriate exit code whenever a
build fails.
Also, from now handle_ftbfs() will take care of all the steps required
to save a build
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
84dffbff by Mattia Rizzolo at 2018-06-19T17:17:45+02:00
reproducible debian: build.sh: print out the duration at the end of the cleanup
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
53e059fd by Mattia Rizzolo at 2018-06-19T17:17:48+02:00
reproducible debian: build.sh: don't send IRC notification for NOTIFY=0
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
d012e181 by Mattia Rizzolo at 2018-06-19T17:17:50+02:00
reproducible debian: build.sh: turn list of elif into a case
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
256e1d88 by Mattia Rizzolo at 2018-06-19T17:17:52+02:00
reproducible debian: build.sh: merge filter_changes_files() into call_diffoscope_on_changes_files()
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
e7cde572 by Mattia Rizzolo at 2018-06-19T17:17:54+02:00
reproducible debian: build.sh: move the post-build steps into build_rebuild() instead of the main script body
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
1 changed file:
- bin/reproducible_build.sh
Changes:
=====================================
bin/reproducible_build.sh
=====================================
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -5,6 +5,12 @@
# © 2015-2018 Mattia Rizzolo <mattia at debian.org>
# released under the GPLv=2
+# Exit status of this script:
+# - when run in remote mode:
+# - 2 → the build failed
+# - 3 → the build timeouted
+# - 404 → failed to download the sources
+
DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
@@ -101,17 +107,23 @@ save_artifacts() {
cleanup_all() {
echo "Starting cleanup."
+ cd # move out of $TMPDIR, if we are still inside
if [ "$SAVE_ARTIFACTS" = "1" ] ; then
save_artifacts # this will also notify IRC as needed
- elif [ "$NOTIFY" = "2" ] ; then
- irc_message debian-reproducible "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE done: $STATUS debug: $NOTIFY"
- elif [ "$NOTIFY" = "1" ] ; then
- irc_message debian-reproducible "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE done: $STATUS"
- elif [ "$NOTIFY" = "diffoscope" ] ; then
- irc_message debian-reproducible-changes "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE $STATUS and $DIFFOSCOPE failed"
- elif [ ! -z "$NOTIFY" ] ; then
- # a weird value of $NOTIFY that we don't know about
- irc_message debian-reproducible-changes "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE done: $STATUS debug: $NOTIFY"
+ else
+ case "$NOTIFY" in
+ 0) ;;
+ 1|2)
+ irc_message debian-reproducible "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE done: $STATUS"
+ ;;
+ diffoscope)
+ irc_message debian-reproducible-changes "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE $STATUS and $DIFFOSCOPE failed"
+ ;;
+ *)
+ # a weird value of $NOTIFY that we don't know about
+ irc_message debian-reproducible-changes "$DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE done: $STATUS debug: $NOTIFY"
+ ;;
+ esac
fi
[ ! -f $RBUILDLOG ] || gzip -9fvn $RBUILDLOG
if [ "$MODE" = "master" ] ; then
@@ -122,6 +134,7 @@ cleanup_all() {
rm -r $TMPDIR || true
fi
echo "All cleanup done."
+ print_out_duration
}
update_db_and_html() {
@@ -238,9 +251,11 @@ handle_NFU() {
}
handle_ftbfs() {
- if ! "$DEBUG" ; then set +x ; fi
- local BUILD
echo "${SRCPACKAGE} failed to build from source."
+ cleanup_pkg_files
+ diff_copy_buildlogs
+ update_rbuildlog
+ local BUILD NEEDLE
for BUILD in "1" "2"; do
local nodevar="NODE$BUILD"
local node=""
@@ -282,6 +297,7 @@ handle_ftbfs() {
update_db_and_html "FTBFS"
if [ $SAVE_ARTIFACTS -eq 1 ] ; then SAVE_ARTIFACTS=0 ; fi
if [ ! -z "$NOTIFY" ] ; then NOTIFY="failure" ; fi
+ exit 0
}
handle_ftbr() {
@@ -370,6 +386,8 @@ dbd_timeout() {
}
call_diffoscope_on_changes_files() {
+ # filter lines describing .buildinfo files from .changes file
+ sed -i -e '/^ [a-f0-9]\{32,64\} .*\.buildinfo$/d' b{1,2}/$CHANGES
local TMPLOG=$(mktemp --tmpdir=$TMPDIR)
local TIMEOUT="120m"
DBDSUITE=$SUITE
@@ -589,7 +607,6 @@ first_build() {
echo "Date: $(date)"
echo "Date UTC: $(date -u)"
echo "============================================================================="
- set -x
local TMPCFG=$(mktemp -t pbuilderrc_XXXX --tmpdir=$TMPDIR)
cat > "$TMPCFG" << EOF
BUILDUSERID=1111
@@ -619,14 +636,20 @@ EOF
--logfile b1/build.log \
${SRCPACKAGE}_${EVERSION}.dsc
) 2>&1 | log_file -
- PRESULT=${PIPESTATUS[0]}
- if [ $PRESULT -eq 124 ] ; then
- msg="pbuilder was killed by timeout after 18h."
- log_error "$msg"
- echo "$(date -u) - $msg" | tee -a b1/build.log
- fi
+ local PRESULT=${PIPESTATUS[0]}
if ! "$DEBUG" ; then set +x ; fi
rm $TMPCFG
+ case $PRESULT in
+ 124)
+ msg="pbuilder was killed by timeout after 18h."
+ log_error "$msg"
+ echo "$(date -u) - $msg" | tee -a b1/build.log
+ exit 3
+ ;;
+ 1) # FTBFS, for whatever reason.
+ exit 2
+ ;;
+ esac
}
second_build() {
@@ -688,13 +711,20 @@ EOF
--buildresult $TMPDIR/b2 \
--logfile b2/build.log \
${SRCPACKAGE}_${EVERSION}.dsc
- PRESULT=$?
+ local PRESULT=$?
set -e
- if [ $PRESULT -eq 124 ] ; then
- echo "$(date -u) - pbuilder was killed by timeout after 24h." | tee -a b2/build.log
- fi
if ! "$DEBUG" ; then set +x ; fi
rm $TMPCFG
+ case $PRESULT in
+ 124)
+ echo "$(date -u) - pbuilder was killed by timeout after 24h." | tee -a b2/build.log
+ exit 3
+ ;;
+ 1) # FTBFS, for whatever reason.
+ exit 2
+ ;;
+ esac
+
}
check_node_is_up() {
@@ -736,19 +766,20 @@ remote_build() {
check_node_is_up $NODE $PORT $SLEEPTIME
set +e
ssh -o "BatchMode = yes" -p $PORT $NODE /srv/jenkins/bin/reproducible_build.sh $BUILDNR ${SRCPACKAGE} ${SUITE} ${TMPDIR} "$VERSION"
- RESULT=$?
- # 404-256=148... (ssh 'really' only 'supports' exit codes below 255...)
- if [ $RESULT -eq 148 ] ; then
- handle_E404
- elif [ $RESULT -eq 100 ] ; then
- log_error "Version mismatch between main node and build $BUILDNR, aborting. Please upgrade the schroots..."
- # reschedule the package for later and quit the build without saving anything
- query_db "UPDATE schedule SET date_build_started = NULL, job = NULL, date_scheduled='$(date -u +'%Y-%m-%d %H:%M')' WHERE package_id='$SRCPKGID'"
- NOTIFY=""
- exit 0
- elif [ $RESULT -ne 0 ] ; then
- handle_remote_error "with exit code $RESULT from $NODE for build #$BUILDNR for ${SRCPACKAGE} on ${SUITE}/${ARCH}"
- fi
+ local RESULT=$?
+ case $RESULT in
+ 148) # 404-256=148... (ssh 'really' only 'supports' exit codes below 255...)
+ handle_E404
+ ;;
+ 2|3)
+ handle_ftbfs
+ ;;
+ 0) # build succcessfully completed
+ ;;
+ *)
+ handle_remote_error "with exit code $RESULT from $NODE for build #$BUILDNR for ${SRCPACKAGE} on ${SUITE}/${ARCH}"
+ ;;
+ esac
rsync -e "ssh -o 'BatchMode = yes' -p $PORT" -r $NODE:$TMPDIR/b$BUILDNR $TMPDIR/
RESULT=$?
if [ $RESULT -ne 0 ] ; then
@@ -769,11 +800,6 @@ remote_build() {
fi
}
-filter_changes_files() {
- # filter lines describing .buildinfo files from .changes file
- sed -i -e '/^ [a-f0-9]\{32,64\} .*\.buildinfo$/d' b{1,2}/$CHANGES
-}
-
check_installed_build_depends() {
local TMPFILE1=$(mktemp --tmpdir=$TMPDIR)
local TMPFILE2=$(mktemp --tmpdir=$TMPDIR)
@@ -844,23 +870,22 @@ share_buildinfo() {
}
build_rebuild() {
- FTBFS=1
CHANGES="${SRCPACKAGE}_${EVERSION}_${ARCH}.changes" # changes file with expected version
mkdir b1 b2
log_info "Starting 1st build on remote node $NODE1."
remote_build 1 $NODE1
- if [ -f b1/$CHANGES ] ; then
- log_info "1st build successful. Starting 2nd build on remote node $NODE2."
- remote_build 2 $NODE2
- if [ -f b2/$CHANGES ] ; then
- # both builds were fine, i.e., they did not FTBFS.
- FTBFS=0
- log_info "$CHANGES:"
- log_file b1/$CHANGES
- else
- log_error "the second build failed, even though the first build was successful."
- fi
- fi
+ log_info "1st build successful. Starting 2nd build on remote node $NODE2."
+ remote_build 2 $NODE2
+ # at this point, both builds were fine, i.e., they did not FTBFS.
+ log_info "$CHANGES:"
+ log_file b1/$CHANGES
+ check_installed_build_depends
+ # save the build:
+ cleanup_pkg_files
+ diff_copy_buildlogs
+ update_rbuildlog
+ call_diffoscope_on_changes_files # defines DIFFOSCOPE, update_db_and_html defines STATUS
+ share_buildinfo
}
#
@@ -934,23 +959,4 @@ log_info "${SRCPACKAGE}_${EVERSION}.dsc"
log_file ${SRCPACKAGE}_${EVERSION}.dsc
check_suitability
-build_rebuild # defines FTBFS, CHANGES redefines RBUILDLOG
-if [ $FTBFS -eq 0 ] ; then
- check_installed_build_depends
-fi
-cleanup_pkg_files
-diff_copy_buildlogs
-update_rbuildlog
-if [ $FTBFS -eq 1 ] ; then
- handle_ftbfs
-elif [ $FTBFS -eq 0 ] ; then
- filter_changes_files
- call_diffoscope_on_changes_files # defines DIFFOSCOPE, update_db_and_html defines STATUS
- share_buildinfo
-fi
-print_out_duration
-
-cd ..
-cleanup_all
-trap - INT TERM EXIT
-
+build_rebuild
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/41d222900d0ca3e1b79465e8dace7127e38be5df...e7cde572183577d53eaf2d0d86cfe70ab1d2e9bd
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/41d222900d0ca3e1b79465e8dace7127e38be5df...e7cde572183577d53eaf2d0d86cfe70ab1d2e9bd
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20180619/84f210ae/attachment-0001.html>
More information about the Qa-jenkins-scm
mailing list