[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] djm: support -d/--dry-run instead of using $4

Holger Levsen (@holger) gitlab at salsa.debian.org
Thu Apr 27 22:12:39 BST 2023



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
aee29346 by Holger Levsen at 2023-04-27T23:12:23+02:00
djm: support -d/--dry-run instead of using $4

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


2 changed files:

- TODO
- bin/djm


Changes:

=====================================
TODO
=====================================
@@ -24,6 +24,7 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian
 
 === 2023 things
 
+* setup ionosXY for janitor (remove ionos3 duplicate first)
 * decouple t.r-b.o from jenkins.d.n (https hosting wise), maybe even www.r-b.o
 * rename jenkins to hudson? (the hostname)
 * maintenance job: 
@@ -31,7 +32,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:
-** -d/--dry-run so $4 is free...
+** ACTION: ff - fix future
+** ACTION: c (or rc) - run command
 ** get rif of deploy_jdn
 *** and while at it, make actions triggering 'all' be only one entry in the djm logfile -> more sensible stats
 ** cleanup/backup logs on the first of the month
@@ -46,6 +48,7 @@ See link:https://jenkins.debian.net/userContent/about.html["about jenkins.debian
 ** include notmuch mails, "received and read". write djm-notmuch-parser.
 ** include amount of job runs on jenkins
 * djm-jenknis-parser:
+** should be called from djm (if local log is older than 12h) and not from djm-logparser (so that it's enough to run djm-logparser once a month or so)
 ** cleanup/backup logs on the first of the month
 
 === nodes at OSUOSL


=====================================
bin/djm
=====================================
@@ -16,10 +16,16 @@ set -o pipefail		# see eg http://petereisentraut.blogspot.com/2010/11/pipefail.h
 #
 
 LOGFILE=~/.djm.log
+if [ "$1" = "-d" ] || [ "$1" = "--dry-run" ] ; then
+	DRY_MODE=true
+	shift
+else
+	DRY_MODE=false
+fi
+
 TARGET=$1
 ACTION=$2
 REASON=$3
-DRY_RUN=$4
 FAIL_REASON=""
 CONFIRM=false
 
@@ -63,12 +69,6 @@ case $REASON in
 			;;
 esac
 
-if [ -z "$DRY_RUN" ] ; then
-	DRY_MODE=false
-else
-	DRY_MODE=true
-fi
-
 #
 # some targets only allow specific actions
 #
@@ -86,21 +86,20 @@ fi
 if [ -n "$FAIL_REASON" ] ; then
 	echo
 	echo problem parsing parameters, djm needs at least three:
+	echo "djm -d/--dry-run \$TARGET \$ACTION \$REASON"
 	echo
-	echo "TARGET=\$1	'all' or grepable (jenkins, amd64, ionos, osuosl3) from ./nodes/list_nodes"
-	echo "          	or special target '.'"
-	echo "ACTION=\$2	r_eboot, _p_owercycle, _a_utoremove, _s_shell (for manual maintenance),"
-	echo "          	_j_enkins-ui or _b_ring-back"
-	echo "REASON=\$3	ku=kernel update, np=no pings, dj=debug job problems, rm=regular maintenance,"
-	echo "          	cs=clock skew, hb=host back, ho=host overloaded, nt=new things"
-	echo "DRY_RUN=\$4	optional to force dry-run mode"
+	echo "TARGET=	'all' or grepable (jenkins, amd64, ionos, osuosl3) from ./nodes/list_nodes"
+	echo "         	or special target '.'"
+	echo "ACTION=	r_eboot, _p_owercycle, _a_utoremove, _s_shell (for manual maintenance),"
+	echo "         	_j_enkins-ui or _b_ring-back"
+	echo "REASON=	ku=kernel update, np=no pings, dj=debug job problems, rm=regular maintenance,"
+	echo "         	cs=clock skew, hb=host back, ho=host overloaded, nt=new things"
 	echo
 	echo params given:
 	echo
 	echo "\$1 = $1"
 	echo "\$2 = $2"
 	echo "\$3 = $3"
-	echo "\$4 = $4"
 	echo
 	echo parsing problems:
 	echo



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/aee29346d5c28edb53ddd4dfa98ded1d13e71911

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/aee29346d5c28edb53ddd4dfa98ded1d13e71911
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/20230427/0ef41fb3/attachment-0001.htm>


More information about the Qa-jenkins-scm mailing list