Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76504


Change subject: prepare wmf-beta-autoupdate to be launched by Jenkins
......................................................................

prepare wmf-beta-autoupdate to be launched by Jenkins

This let wmf-beta-autoupdate to be run by a Jenkins job. It removes the
upstart wrapper and the script is no more looping indefinitely. It now
as to be run from time to time as user mwdeploy, which is what Jenkins
is going to do.

That would let people retrigger the update easily and provide a public
log of the run for other to investigate.

Change-Id: I0d9cc6162787f011249717803bad622d58f64eec
---
M files/misc/beta/wmf-beta-autoupdate
D files/misc/beta/wmf-beta-autoupdate.default
D files/upstart/wmf-beta-autoupdate.conf
M manifests/misc/beta.pp
4 files changed, 22 insertions(+), 108 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/04/76504/1

diff --git a/files/misc/beta/wmf-beta-autoupdate 
b/files/misc/beta/wmf-beta-autoupdate
index 80b8e41..cee137d 100755
--- a/files/misc/beta/wmf-beta-autoupdate
+++ b/files/misc/beta/wmf-beta-autoupdate
@@ -14,7 +14,6 @@
 # Parameters with sane (to the WMF) default values
 MW_CORE_PATH=${MW_CORE_PATH:-"/home/wikipedia/common/php-master"}
 MW_EXTENSIONS_PATH=${MW_EXTENSIONS_PATH:-"$MW_CORE_PATH/extensions"}
-WMF_BETA_AUTOUPDATE_SLEEP=${WMF_BETA_AUTOUPDATE_SLEEP:-180}
 VERBOSE=${VERBOSE:-"no"}
 
 if [ "$VERBOSE" != "no" ]; then
@@ -44,39 +43,23 @@
        ts_echo "Exit code: $exitcode"
 }
 
-# When killed, make sure we are also getting rid of the child jobs
-# we have spawned.
-trap 'kill %-; exit' SIGTERM
+ts_echo "update MediaWiki core in $MW_CORE_PATH"
+OUTPUT=`(cd $MW_CORE_PATH && $GIT_PULL 2>&1)`
+handle_command_result $? "$OUTPUT"
 
-# Start infinite loop
-while [ 1 ]; do
-
-       ts_echo "update MediaWiki core in $MW_CORE_PATH"
-#      if [ ! -d "${MW_CORE_PATH}/.git" ]; then
-#              error "ERR> $MW_CORE_PATH is not a git repo"
-#      else
-               OUTPUT=`(cd $MW_CORE_PATH && $GIT_PULL 2>&1)`
-               handle_command_result $? "$OUTPUT"
-#      fi
-
-       ts_echo "update extensions in $MW_EXTENSIONS_PATH"
-       if [ ! -d "${MW_EXTENSIONS_PATH}/.git" ]; then
-               error "ERR> $MW_EXTENSIONS_PATH is not a git repo"
-       else
-               # Update the generic repository holding all submodules
-               OUTPUT=`(cd $MW_EXTENSIONS_PATH && $GIT_PULL 2>&1)`
-               handle_command_result $? "$OUTPUT"
-               # Update submodules
-               OUTPUT=`(cd $MW_EXTENSIONS_PATH && $GIT_SUBMODULE_UPDATE 2>&1)`
-               handle_command_result $? "$OUTPUT"
-       fi
-
-       # Update localisation cache
-       ts_echo "updating localisation cache"
-       OUTPUT=`(mw-update-l10n)`
+ts_echo "update extensions in $MW_EXTENSIONS_PATH"
+if [ ! -d "${MW_EXTENSIONS_PATH}/.git" ]; then
+       error "ERR> $MW_EXTENSIONS_PATH is not a git repo"
+else
+       # Update the generic repository holding all submodules
+       OUTPUT=`(cd $MW_EXTENSIONS_PATH && $GIT_PULL 2>&1)`
        handle_command_result $? "$OUTPUT"
+       # Update submodules
+       OUTPUT=`(cd $MW_EXTENSIONS_PATH && $GIT_SUBMODULE_UPDATE 2>&1)`
+       handle_command_result $? "$OUTPUT"
+fi
 
-       ts_echo "Sleeping for ${WMF_BETA_AUTOUPDATE_SLEEP} seconds"
-       sleep $WMF_BETA_AUTOUPDATE_SLEEP;
-
-done;
+# Update localisation cache
+ts_echo "updating localisation cache"
+OUTPUT=`(mw-update-l10n)`
+handle_command_result $? "$OUTPUT"
diff --git a/files/misc/beta/wmf-beta-autoupdate.default 
b/files/misc/beta/wmf-beta-autoupdate.default
deleted file mode 100644
index bf9813b..0000000
--- a/files/misc/beta/wmf-beta-autoupdate.default
+++ /dev/null
@@ -1,11 +0,0 @@
-#######################################################################
-# WARNING: this file is managed by Puppet
-# puppet:///files/misc/beta/wmf-beta-autoupdate.default
-#######################################################################
-
-# Enable verbose mode while we pretest this script. Will make git
-# command to not use the "--quiet" parameter giving useful output
-#
-# Set to "no" to disable verbose mode
-#
-VERBOSE=yes
diff --git a/files/upstart/wmf-beta-autoupdate.conf 
b/files/upstart/wmf-beta-autoupdate.conf
deleted file mode 100644
index 7becae7..0000000
--- a/files/upstart/wmf-beta-autoupdate.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-# wmf-beta-autoupdate - Update beta version of MediaWiki
-
-description "Automatic update of beta MediaWiki"
-
-author "Antoine Musso <[email protected]>"
-
-setuid mwdeploy
-
-# start/stop based on ssh
-start on filesystem or runlevel [2345]
-stop on runlevel [!2345]
-
-# Log to /var/log/upstart
-console log
-
-# Low priority is fine
-nice 19
-
-env DEFAULTFILE=/etc/default/wmf-beta-autoupdate
-
-pre-start script
-       test -x /usr/local/bin/wmf-beta-autoupdate || { stop; exit 0; }
-#      mkdir -p -m0755 /var/run/wmf-beta-autoupdate
-end script
-
-script
-       # Load default environnement
-       if [ -f "$DEFAULTFILE" ]; then
-       . "$DEFAULTFILE"
-       fi
-
-       exec /usr/bin/env VERBOSE=${VERBOSE} /usr/local/bin/wmf-beta-autoupdate 
2>&1 1>> /var/log/wmf-beta-autoupdate.log
-end script
-
-#post-stop exec rm -f /var/run/wmf-beta-autoupdate/pid
-
diff --git a/manifests/misc/beta.pp b/manifests/misc/beta.pp
index d86fff8..24ea713 100644
--- a/manifests/misc/beta.pp
+++ b/manifests/misc/beta.pp
@@ -13,19 +13,9 @@
                        ],
                        source => 
"puppet:///files/misc/beta/wmf-beta-autoupdate";
                "/etc/default/wmf-beta-autoupdate":
-                       owner => root,
-                       group => root,
-                       mode => 0444,
-                       source => 
"puppet:///files/misc/beta/wmf-beta-autoupdate.default";
+                       ensure => absent;
                "/etc/init/wmf-beta-autoupdate.conf":
-                       owner => root,
-                       group => root,
-                       mode => 0444,
-                       source => 
"puppet:///files/upstart/wmf-beta-autoupdate.conf";
-               "/var/log/wmf-beta-autoupdate.log":
-                       owner => mwdeploy,
-                       group => mwdeploy,
-                       mode => 0664;
+                       ensure => absent;
        }
 
        # Make sure wmf-beta-autoupdate can run the l10n updater as l10nupdate
@@ -44,21 +34,9 @@
                'ALL = (apache) NOPASSWD: ALL',
        ] }
 
-
-       upstart_job { "wmf-beta-autoupdate": install => true }
-
-       service { "wmf-beta-autoupdate":
-               require => [
-                       File["/usr/local/bin/wmf-beta-autoupdate"],
-                       Upstart_job["wmf-beta-autoupdate"],
-                       Systemuser["mwdeploy"],
-               ],
-               subscribe => [
-                       File["/etc/default/wmf-beta-autoupdate"],
-                       File["/usr/local/bin/wmf-beta-autoupdate"],
-               ],
-               provider => upstart,
-               ensure => running;
+       # Phase out old upstart job
+       file { '/etc/init.d/wmf-beta-autoupdate':
+               ensure => absent;
        }
 
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/76504
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d9cc6162787f011249717803bad622d58f64eec
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to