[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 3 commits: reproducible debian: build.sh: reinstate saving the builds in stats_build
Mattia Rizzolo
gitlab at salsa.debian.org
Thu Jun 21 10:48:29 BST 2018
Mattia Rizzolo pushed to branch master at Debian QA / jenkins.debian.net
Commits:
c8b887fe by Mattia Rizzolo at 2018-06-21T11:28:36+02:00
reproducible debian: build.sh: reinstate saving the builds in stats_build
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
3cb06dd7 by Mattia Rizzolo at 2018-06-21T11:45:47+02:00
reproducible: common.sh: error out when `psql` fails
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
34570a21 by Mattia Rizzolo at 2018-06-21T11:46:08+02:00
reproducible debian: build.sh: do an UPSERT insted of manually checking for presence before UPDATE/INSERT
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
- - - - -
2 changed files:
- bin/reproducible_build.sh
- bin/reproducible_common.sh
Changes:
=====================================
bin/reproducible_build.sh
=====================================
--- a/bin/reproducible_build.sh
+++ b/bin/reproducible_build.sh
@@ -169,13 +169,9 @@ update_db_and_html() {
echo "$(date -u +'%Y-%m-%d %H:%M') $DEBIAN_URL/$SUITE/$ARCH/$SRCPACKAGE changed from $OLD_STATUS -> $STATUS" >> /srv/reproducible-results/notification-emails/$SRCPACKAGE
fi
fi
- RESULTID=$(query_db "SELECT id FROM results WHERE package_id=$SRCPKGID")
- # Insert or replace existing entry in results table
- if [ ! -z "$RESULTID" ] ; then
- query_db "UPDATE results set package_id='$SRCPKGID', version='$VERSION', status='$STATUS', build_date='$DATE', build_duration='$DURATION', node1='$NODE1', node2='$NODE2', job='$JOB' WHERE id=$RESULTID"
- else
- query_db "INSERT INTO results (package_id, version, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')"
- fi
+ # Insert or update existing entry in results table
+ query_db "INSERT INTO results (package_id, version, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPKGID', '$VERSION', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB') ON CONFLICT (package_id) DO UPDATE SET version='$VERSION', status='$STATUS', build_date='$DATE', build_duration='$DURATION', node1='$NODE1', node2='$NODE2', job='$JOB' WHERE package_id='$SRCPKGID'"
+ query_db "INSERT INTO stats_build (name, version, suite, architecture, status, build_date, build_duration, node1, node2, job) VALUES ('$SRCPACKAGE', '$VERSION', '$SUITE', '$ARCH', '$STATUS', '$DATE', '$DURATION', '$NODE1', '$NODE2', '$JOB')"
# unmark build since it's properly finished
query_db "DELETE FROM schedule WHERE package_id='$SRCPKGID';"
gen_package_html $SRCPACKAGE
=====================================
bin/reproducible_common.sh
=====================================
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -13,12 +13,12 @@ export PGDATABASE=reproducibledb
# query reproducible database
query_db() {
- psql -t --no-align -c "$@"
+ psql -t --no-align -c "$@" || exit 1
}
# query reproducible database, output to csv format
query_to_csv() {
- psql -c "COPY ($@) to STDOUT with csv DELIMITER ','"
+ psql -c "COPY ($@) to STDOUT with csv DELIMITER ','" || exit 1
}
# common variables
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/ea589323907c16e17edd8280057ba09850e13783...34570a21bbd4372d60793d00c44f357aa3efb748
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/compare/ea589323907c16e17edd8280057ba09850e13783...34570a21bbd4372d60793d00c44f357aa3efb748
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/20180621/4468c751/attachment-0001.html>
More information about the Qa-jenkins-scm
mailing list