[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] djm: new action: deploy-git
Holger Levsen (@holger)
gitlab at salsa.debian.org
Tue May 16 16:43:06 BST 2023
Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net
Commits:
0ce2cc88 by Holger Levsen at 2023-05-16T17:42:46+02:00
djm: new action: deploy-git
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
3 changed files:
- TODO
- bin/djm
- deploy_jdn
Changes:
=====================================
TODO
=====================================
@@ -32,11 +32,11 @@ 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:
-** ACTION: d|eploy-git
** ACTION: rm|stamp
** ACTION: c|command - run arbitrary command (with and without reset_clock)
** then get rid of deploy_jdn
** also log an id, so that one command effecting several hosts is counted as on action
+** new option, to optionally not fix the time (on future hosts) after command, to see failing commands?
*** make actions triggering 'all' be only one entry in the djm logfile -> more sensible stats
** automatically backup+cleanup logs on the first of the month
** new feature: --show-month 04
=====================================
bin/djm
=====================================
@@ -131,6 +131,7 @@ show_help(){
echo "ACTION= one of these:"
echo " _a_utoremove apt autoremove && apt clean"
echo " _b_ring-back mark host as online"
+ echo " _d_eploy-git deploy jenkins.debian.net.git"
echo " _f_fix-future fix clock on hosts running in the future"
echo " _j_enkins-ui for when doing things manually in the jenkins-ui"
echo " _p_owercycle"
@@ -186,6 +187,7 @@ verify_target_action_reason(){
case $ACTION in
a|autoremove) ACTION=autoremove ;;
b|bring-back) ACTION=bring-back ;;
+ d|deploy-git) ACTION=deploy-git ;;
f|fix-future) ACTION=fix-future ;;
j|jenkins-ui) ACTION=jenkins-ui ;;
p|powercycle) ACTION=powercycle ; CONFIRM=true ;;
@@ -516,6 +518,35 @@ djm_do() {
COMMAND="( $COMMAND ) || ( echo press enter ; read a ) ; echo 'sleeping 10s now' ; sleep 10"
xterm -T "$SHORTNODE / $ACTION" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh -t $NODE \"$COMMAND\"" &
;;
+ deploy-git) GIT_REPO="https://salsa.debian.org/qa/jenkins.debian.net.git"
+ unset GITOPTS
+ if node_in_the_future "$SHORTNODE"; then
+ GITOPTS="-c http.sslVerify=false"
+ fi
+ # real command for running manually: cd ~jenkins-adm/jenkins.debian.net/ ; sudo -H -u jenkins-adm git pull ; ./update_jdn.sh
+ read -r -d '' COMMAND <<-EOF || true
+ set -e
+ set -o pipefail
+ export LANG=C
+ cd ~jenkins-adm
+ if [ ! -d jenkins.debian.net ]; then
+ [ -x /usr/bin/git ] || sudo apt-get install -y git
+ sudo -H -u jenkins-adm git ${GITOPTS:-} clone $GIT_REPO
+ cd jenkins.debian.net
+ else
+ cd jenkins.debian.net
+ sudo -H -u jenkins-adm git config pull.ff only
+ sudo -H -u jenkins-adm git ${GITOPTS:-} pull $GIT_REPO
+ fi
+ ./update_jdn.sh 2>&1 | sudo tee -a /var/log/jenkins/update_jdn.log
+ EOF
+ echo -n "$COMMAND"
+ if node_in_the_future "$SHORTNODE" ; then
+ COMMAND="sudo ntpdate -b $NTP_SERVER ; $COMMAND ; sudo date --set='+398 days +6 hours + 23 minutes'"
+ fi
+ COMMAND="( $COMMAND ) || ( echo press enter ; read a ) ; echo 'sleeping 10s now' ; sleep 10"
+ xterm -T "$SHORTNODE / $ACTION" -class deploy-jenkins -bg $BG -fa 'DejaVuSansMono' -fs 10 -e "ssh -t $NODE \"$COMMAND\"" &
+ ;;
*) echo unsupported action, sorry, please improve.
exit 1
;;
=====================================
deploy_jdn
=====================================
@@ -192,6 +192,7 @@ for i in "${HOSTS[@]}" ; do
# real command, for running manually: cd ~jenkins-adm/jenkins.debian.net/ ; sudo -H -u jenkins-adm git pull ; ./update_jdn.sh
read -r -d '' remote_command <<-EOF
set -e
+ set -o pipefail
export LANG=C
cd ~jenkins-adm
if [ ! -d jenkins.debian.net ]; then
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/0ce2cc88743b083fbe58537b859e435dee51a8e0
--
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/-/commit/0ce2cc88743b083fbe58537b859e435dee51a8e0
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/20230516/fdcce0f3/attachment-0001.htm>
More information about the Qa-jenkins-scm
mailing list