summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/reproducible_common.sh39
-rwxr-xr-xbin/reproducible_maintenance.sh8
-rwxr-xr-xbin/reproducible_remote_scheduler.py3
-rwxr-xr-xbin/reproducible_schedule_on_demand.sh35
4 files changed, 13 insertions, 72 deletions
diff --git a/bin/reproducible_common.sh b/bin/reproducible_common.sh
index 9cf4f514..1a4b81af 100755
--- a/bin/reproducible_common.sh
+++ b/bin/reproducible_common.sh
@@ -92,44 +92,7 @@ META_PKGSET[26]="maint_debian-boot"
META_PKGSET[27]="maint_debian-ocaml"
schedule_packages() {
- # these packages are manually scheduled, so should have high priority,
- # so schedule them in the past, so they are picked earlier :)
- # the current date is subtracted twice, so that packages scheduled later get higher will be picked sooner
- DAYS=$(echo "$(date +'%j')*2"|bc)
- HOURS=$(echo "$(date +'%H')*2"|bc)
- MINS=$(date +'%M') # schedule on the full hour so we can recognize them easily
- DATE=$(date +'%Y-%m-%d %H:%M' -d "$DAYS day ago - $HOURS hours - $MINS minutes")
- TMPFILE=$(mktemp --tmpdir=$TEMPDIR)
- for PKG_ID in $@ ; do
- echo "REPLACE INTO schedule (package_id, date_scheduled, date_build_started, save_artifacts, notify) VALUES ('$PKG_ID', '$DATE', '', '$ARTIFACTS', '$NOTIFY');" >> $TMPFILE
- done
- cat $TMPFILE | sqlite3 -init $INIT ${PACKAGES_DB}
- rm $TMPFILE
- cd /srv/jenkins/bin
- python3 -c "from reproducible_html_indexes import generate_schedule; generate_schedule()"
-}
-
-check_candidates() {
- PACKAGE_IDS=""
- PACKAGES_NAMES=""
- TOTAL=0
- for PKG in $CANDIDATES ; do
- RESULT=$(sqlite3 -init $INIT ${PACKAGES_DB} "SELECT id, name from sources WHERE name='$PKG' AND suite='$SUITE';")
- if [ ! -z "$RESULT" ] ; then
- PACKAGE_IDS="$PACKAGE_IDS $(echo $RESULT|cut -d '|' -f 1)"
- PACKAGES_NAMES="$PACKAGES_NAMES $(echo $RESULT|cut -d '|' -f 2)"
- let "TOTAL+=1"
- fi
- done
- PACKAGE_IDS=$(echo $PACKAGE_IDS)
- case $TOTAL in
- 1)
- PACKAGES_TXT="package"
- ;;
- *)
- PACKAGES_TXT="packages"
- ;;
- esac
+ LC_USER="$REQUESTER" LOCAL_CALL="true" /srv/jenkins/bin/reproducible_remote_scheduler.py --no-notify --suite "$UITE" $@
}
write_page() {
diff --git a/bin/reproducible_maintenance.sh b/bin/reproducible_maintenance.sh
index 49817707..3e4feec5 100755
--- a/bin/reproducible_maintenance.sh
+++ b/bin/reproducible_maintenance.sh
@@ -77,13 +77,9 @@ if [ ! -z "$FAILED_BUILDS" ] ; then
echo
echo "Rescheduling packages: "
for SUITE in $(echo $FAILED_BUILDS | sed "s# #\n#g" | cut -d "/" -f8 | sort -u) ; do
+ REQUESTER="jenkins maintenance job"
CANDIDATES=$(for PKG in $(echo $FAILED_BUILDS | sed "s# #\n#g" | grep "/$SUITE/" | cut -d "/" -f10 | cut -d "_" -f1) ; do echo -n "$PKG " ; done)
- check_candidates
- if [ $TOTAL -ne 0 ] ; then
- echo " - in $SUITE: $CANDIDATES"
- ARTIFACTS=0
- schedule_packages $PACKAGE_IDS
- fi
+ schedule_packages $SUITE $CANDIDATES
done
DIRTY=true
fi
diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py
index 6259d0df..bee9a741 100755
--- a/bin/reproducible_remote_scheduler.py
+++ b/bin/reproducible_remote_scheduler.py
@@ -173,6 +173,7 @@ cursor.executemany(query2, save_schedule)
conn_db.commit()
log.info(bcolors.GOOD + message + bcolors.ENDC)
-irc_msg(message)
+if requester != "jenkins maintenance job" and not local:
+ irc_msg(message)
generate_schedule() # the html page
diff --git a/bin/reproducible_schedule_on_demand.sh b/bin/reproducible_schedule_on_demand.sh
index d9f50626..f7e3af35 100755
--- a/bin/reproducible_schedule_on_demand.sh
+++ b/bin/reproducible_schedule_on_demand.sh
@@ -11,9 +11,6 @@ common_init "$@"
# common code defining db access
. /srv/jenkins/bin/reproducible_common.sh
-#
-# main
-#
set +x
ARTIFACTS=0
NOTIFY=''
@@ -31,6 +28,13 @@ if [ "$SUITE" = "sid" ] ; then
SUITE=unstable
fi
+if [ ! -z "$SUDO_USER" ] ; then
+ REQUESTER="$SUDO_USER"
+else
+ echo "Looks like you logged into this host as the jenkins user without sudoing to it. How can that be possible?!?!"
+ REQUESTER="$USER"
+fi
+
CANDIDATES="$@"
if [ ${#} -gt 50 ] && [ "$NOTIFY" = "true" ] ; then
echo
@@ -39,29 +43,6 @@ if [ ${#} -gt 50 ] && [ "$NOTIFY" = "true" ] ; then
echo
exit 1
fi
-check_candidates
-if [ ${#PACKAGE_IDS} -gt 256 ] ; then
- BLABLABLA="✂…"
-fi
-ACTION="manually rescheduled"
-if [ -n "${BUILD_URL:-}" ] ; then
- ACTION="rescheduled by $BUILD_URL"
-fi
-MESSAGE="$TOTAL $PACKAGES_TXT $ACTION in $SUITE: ${PACKAGES_NAMES:0:256}$BLABLABLA"
-if [ $ARTIFACTS -eq 1 ] ; then
- MESSAGE="$MESSAGE - artifacts will be preserved."
-elif [ "$NOTIFY" = "true" ] ; then
- MESSAGE="$MESSAGE - notification once finished."
-fi
# finally
-schedule_packages $PACKAGE_IDS
-echo
-echo "$MESSAGE"
-if [ -z "${BUILD_URL:-}" ] && [ $TOTAL -ne 0 ] ; then
- kgb-client --conf /srv/jenkins/kgb/debian-reproducible.conf --relay-msg "$MESSAGE"
-fi
-echo "============================================================================="
-echo "The following $TOTAL source $PACKAGES_TXT $ACTION for $SUITE: $PACKAGES_NAMES"
-echo "============================================================================="
-echo
+schedule_packages $CANDIDATES