[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] 2 commits: djm: improve show_help() text
Holger Levsen (@holger)
gitlab at salsa.debian.org
Thu Jun 8 22:25:31 BST 2023
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
8f3e6d5f by Holger Levsen at 2023-06-08T23:24:05+02:00
djm: improve show_help() text
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
943c2d8e by Holger Levsen at 2023-06-08T23:25:19+02:00
djm: prevent --fetch and --month and/or --year combinations
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
2 changed files:
- TODO
- bin/djm
Changes:
=====================================
TODO
=====================================
@@ -48,6 +48,8 @@ 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:
+** option: -a/--action $1 $2 $3 and thus make djm_do a shortcut
+** option: -a/--annual-report as -y is taken too. hmmm.
** action: rk / remove-oldest-kernel
** action: sm / shell-monitor
** action: rj / restart-jenkins
@@ -65,6 +67,7 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian
** also log an id, so that one command effecting several hosts is counted as on action
*** make actions triggering 'all' be only one entry in the djm logfile -> more sensible stats
** maybe:
+*** document git commits to jenkins.d.n.git
*** document running "mosh jenkins shell-monitor" processes?
*** document jenkins plugin updates -> manually or though my local script which calls the webpages could log this more easily
**** my local script should call djm and not write logfile entries itself...
=====================================
bin/djm
=====================================
@@ -17,6 +17,7 @@ set -o pipefail # see eg http://petereisentraut.blogspot.com/2010/11/pipefail.h
DRY_RUN=false
VERBOSE=false
FETCH=false
+NO_FETCH=false
NO_FUTURE=false
LOGFILE=~/.djm.log
FAIL_REASON=""
@@ -97,6 +98,7 @@ while true; do
exit 1
fi
MONTH=$(printf "%02d" $2)
+ NO_FETCH=true
shift 2
continue
;;
@@ -121,6 +123,7 @@ while true; do
exit 1
fi
YEAR=$2
+ NO_FETCH=true
shift 2
continue
;;
@@ -134,6 +137,11 @@ while true; do
;;
esac
done
+# some options don't make much sense
+if $FETCH && $NO_FETCH ; then
+ echo "Options --fetch and --month and/or --year together should not be combined."
+ exit 1
+fi
# show report if not called with any options
if [ -z "$MODE" ] ; then
if [ -z "$1" ] ; then
@@ -148,12 +156,16 @@ show_help(){
djm_header
seperator "="
echo
- 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"
+ echo "djm shows report (and sometimes fetches remote data)"
+ echo "djm -h/--help shows this help"
+ echo "djm -d/--dry-run * will not actually do *"
+ echo "djm -f/--fetch (*) force fetching remote data (and optionally do *)"
+ echo "djm -r/--report shows report (and sometimes fetches remote data)"
+ echo "djm -v/--verbose * do * verbosely"
+ echo "djm -m/--month MONTH define MONTH for showing report"
+ echo "djm -y/--year YEAR define YEAR for showing report"
+ echo "djm -n/--no-future * do *, and then keep 'future hosts' running in the present"
+ echo "djm TARGET ACTION REASON do ACTION on all TARGET(s) for REASON, see below: "
echo
echo "TARGET= 'all' or grepable (jenkins, amd64, ionos, osuosl3) from ./nodes/list_nodes"
echo " or special target '.' for jenkins-ui ACTION."
@@ -322,6 +334,7 @@ djm_fetch() {
djm_report() {
if [ "$LOGMONTH" != "${YEAR}-${MONTH}" ] ; then
+ # use local variables to not cause a mess with djm_fetch()...
local LOGMONTH=${YEAR}-${MONTH}
local LOCAL_LOGFILE=~/.djm.log.${YEAR}-${MONTH}
local UI_LOGFILE=~/.djm-jenkins-ui.log.${YEAR}-${MONTH}
@@ -662,12 +675,12 @@ show_fixmes() {
djm_finish() {
DUMMY=$(mktemp)
touch -d "$(date -u -d "12 hours ago" '+%Y-%m-%d %H:%M') UTC" $DUMMY
- if $FETCH || [ ! -f $JOBS ] || [ $DUMMY -nt $JOBS ] ; then
+ if ! $NO_FETCH || $FETCH || [ ! -f $JOBS ] || [ $DUMMY -nt $JOBS ] ; then
if ! $DRY_RUN ; then
echo "Fetching remote logs."
djm_fetch
fi
- else
+ elif ! $NO_FETCH ; then
echo "Not fetching remote logs."
fi
rm $DUMMY
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/c841847709e6910ca4e57341eca39ae952eab98f...943c2d8e53fa9f8a942c94914e4ca1547e1af199
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/compare/c841847709e6910ca4e57341eca39ae952eab98f...943c2d8e53fa9f8a942c94914e4ca1547e1af199
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/a13de2b6/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list