[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 4 commits: shell monitor: improve "visual status" summary further
Holger Levsen (@holger)
gitlab at salsa.debian.org
Thu Jun 8 14:38:38 BST 2023
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
7cd36012 by Holger Levsen at 2023-06-08T14:16:56+02:00
shell monitor: improve "visual status" summary further
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
ba354232 by Holger Levsen at 2023-06-08T14:30:29+02:00
djm: update TODO, drop comment which has become obsolete
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
3cf8c3da by Holger Levsen at 2023-06-08T15:23:40+02:00
djm: add two new options, --month and --year, to show older reports
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
c8418477 by Holger Levsen at 2023-06-08T15:37:04+02:00
shell monitor: clearly indicate when jenkins is in shutdown mode
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
3 changed files:
- TODO
- bin/djm
- bin/jenkins-shell-monitor.sh
Changes:
=====================================
TODO
=====================================
@@ -48,7 +48,6 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian
** maybe: rm /tmp/mmdebstrap.* older than 3 days
* split TODO in TODO and TODO.legacy?
* djm:
-** new feature: --show-month 04
** action: rk / remove-oldest-kernel
** action: sm / shell-monitor
** action: rj / restart-jenkins
@@ -56,6 +55,9 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian
** action: so / show-offline
** action: ao / all-online / mark all online
** action: s|top-builds: 1st stop build service, 2nd stop builds on all nodes
+*** only on jenkins
+*** as root: service reproducible_build at startup stop
+*** as jenkins: /srv/jenkins/bin/reproducible_cleanup_nodes.sh (twice)
** option: --today to be used with action shell (and maybe others)
** option: --dont-wait4-enter, default being wait for enter.
** option: --no-fetch
=====================================
bin/djm
=====================================
@@ -29,7 +29,9 @@ COMMAND=
LOCAL_LOGFILE=~/.djm.log
UI_LOGFILE=~/.djm-jenkins-ui.log
PARSER_CACHE=~/.djm-jenkins-parser.cache
-LOGMONTH="$(date -u '+%Y-%m')"
+YEAR="$(date -u '+%Y')"
+MONTH="$(date -u '+%m')"
+LOGMONTH=${YEAR}-${MONTH}
JOBS=~/.djm-jobs.txt
if [ -z "$DJM_USER" ] ; then
if [ -n "$DEBFULLNAME" ] ; then
@@ -64,7 +66,7 @@ node_in_the_future () {
#
# thanks to /usr/share/doc/util-linux/examples/getopt-parse.bash
-TEMP=$(getopt -o 'dfhnrv' --long 'dry-run,fetch,help,no-future,report,verbose' -n 'djm' -- "$@")
+TEMP=$(getopt -o 'dfhm:nrvy:' --long 'dry-run,fetch,help,month:,no-future,report,verbose,year:' -n 'djm' -- "$@")
if [ $? -ne 0 ]; then
echo 'Terminating...' >&2
exit 1
@@ -89,6 +91,15 @@ while true; do
shift
continue
;;
+ '-m'|'--month')
+ if [[ ! "$2" =~ ^[0-9]+$ ]] || [ $2 -lt 1 ] || [ $2 -gt 12 ] ; then
+ echo "Invalid --month specified: $2" >&2
+ exit 1
+ fi
+ MONTH=$(printf "%02d" $2)
+ shift 2
+ continue
+ ;;
'-n'|'--no-future')
NO_FUTURE=true
shift
@@ -104,6 +115,15 @@ while true; do
shift
continue
;;
+ '-y'|'--year')
+ if [[ ! "$2" =~ ^[0-9]+$ ]] || [ $2 -lt 2023 ] || [ $2 -gt 2342 ] ; then
+ echo "Invalid --year specified: $2" >&2
+ exit 1
+ fi
+ YEAR=$2
+ shift 2
+ continue
+ ;;
'--')
shift
break
@@ -131,9 +151,9 @@ show_help(){
echo Either of these are possible:
# FIXME: explain this better
echo "djm -d/--dry-run -f/--fetch -r/--report -v/--verbose -h/--help"
+ echo "djm -m/--month MONTH"
+ echo "djm -y/--year YEAR"
echo "djm -d/--dry-run -n/--no-future \$TARGET \$ACTION \$REASON"
- # --no-future is useful, because setting the time to the future
- # will succeed and thus hide earlier issues.
echo
echo "TARGET= 'all' or grepable (jenkins, amd64, ionos, osuosl3) from ./nodes/list_nodes"
echo " or special target '.' for jenkins-ui ACTION."
@@ -301,6 +321,11 @@ djm_fetch() {
}
djm_report() {
+ if [ "$LOGMONTH" != "${YEAR}-${MONTH}" ] ; then
+ local LOGMONTH=${YEAR}-${MONTH}
+ local LOCAL_LOGFILE=~/.djm.log.${YEAR}-${MONTH}
+ local UI_LOGFILE=~/.djm-jenkins-ui.log.${YEAR}-${MONTH}
+ fi
TMP_LOGFILE=$(mktemp)
cat $LOCAL_LOGFILE $UI_LOGFILE | grep ^$LOGMONTH | sort -u > $TMP_LOGFILE
TOTAL=$(grep -c ^$LOGMONTH $TMP_LOGFILE)
@@ -361,7 +386,7 @@ djm_report() {
html alpine archlinux builder_archlinux openwrt .*fedora builds opensuse .*strap
.*diffoscope reprotest disorderfs .*lfs" # .*(json|db|lfs)"
PIPE_PATTERNS=$(echo $PATTERNS | sed 's# #|#g')
- HEADING="$(cat $UI_LOGFILE | wc -l) jobs triggered manually:"
+ HEADING="$(cat $TMP_LOGFILE | grep jenkins-ui | wc -l) jobs triggered manually:"
printf_heading "$HEADING"
(
for i in $PATTERNS ; do
@@ -374,10 +399,8 @@ djm_report() {
seperator "="
rm $TMP_LOGFILE
-
}
-
get_arch_color() {
#
# define terminal background color based on architecture
=====================================
bin/jenkins-shell-monitor.sh
=====================================
@@ -136,6 +136,11 @@ main_loop() {
for i in $SEQ1 ; do
# the inner loop is run more often
clear
+ if $(curl -s https://jenkins.debian.net/api/ |grep -q "Jenkins is going to shut down") ; then
+ SHUTDOWN_MODE=true
+ else
+ SHUTDOWN_MODE=false
+ fi
LOAD="$(uptime | rev | cut -d ',' -f1-3 | rev | cut -d ':' -f2-|xargs echo)"
INTEGER_LOAD=$(echo $LOAD | cut -d '.' -f1)
# based on 23 CPUs
@@ -177,8 +182,27 @@ main_loop() {
echo -e "$OFFLINE_NODES"
echo
fi
- figlet $(cat ~/userContent/reproducible/trbo.status)
- echo " ^^^ trbo status, see https://tests.reproducible-builds.org/trbo.status.html"
+ STATUS=$(cat ~/userContent/reproducible/trbo.status || 0)
+ if [ $STATUS -gt 239 ] ; then
+ echo -e "${GREEN}$STATUS = trbo status${FOREGROUND_COLOR}, see https://tests.reproducible-builds.org/trbo.status.html"
+ else
+ if [ $STATUS -gt 223 ] ; then
+ echo
+ elif [ $STATUS -gt 207 ] ; then
+ echo -e -n "$YELLOW"
+ elif [ $STATUS -gt 191 ] ; then
+ echo -e -n "$ORANGE"
+ else
+ echo -e -n "$RED"
+ fi
+ figlet $STATUS
+ echo -e -n "${FOREGROUND_COLOR}"
+ echo " ^^^ trbo status, see https://tests.reproducible-builds.org/trbo.status.html"
+ fi
+ if $SHUTDOWN_MODE ; then
+ echo
+ echo -e " ${YELLOW}FYI: jenkins is in SHUTDOWN mode.${FOREGROUND_COLOR}"
+ fi
echo
echo "uptime: $(uptime -p | cut -d ' ' -f2-)"
echo -e "load averages: $LOAD"
@@ -215,8 +239,9 @@ SEQ0=0
# static colors
FOREGROUND_COLOR=$(tput sgr0)
RED=$(tput setaf 1)
-YELLOW=$(tput setaf 3)
ORANGE=(tput setaf 166)
+YELLOW=$(tput setaf 3)
+GREEN=$(tput setaf 2)
# main loop
while true ; do
main_loop
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/c88c241e99df7bf8da18acdeb8da853b8a520af4...c841847709e6910ca4e57341eca39ae952eab98f
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/c88c241e99df7bf8da18acdeb8da853b8a520af4...c841847709e6910ca4e57341eca39ae952eab98f
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/20230608/9b5d8c9f/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list