jenkins-bot has submitted this change and it was merged.
Change subject: Added "git-update" command
......................................................................
Added "git-update" command
Change-Id: I120f940cb282a4ad37c75b6025a5527a5be9d332
---
M lib/mediawiki-vagrant.rb
A lib/mediawiki-vagrant/git-update.rb
A puppet/modules/mediawiki/files/run-git-update
M puppet/modules/mediawiki/manifests/init.pp
4 files changed, 57 insertions(+), 0 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/lib/mediawiki-vagrant.rb b/lib/mediawiki-vagrant.rb
index c205cde..b986da6 100644
--- a/lib/mediawiki-vagrant.rb
+++ b/lib/mediawiki-vagrant.rb
@@ -14,6 +14,11 @@
RunTests
end
+ command 'git-update' do
+ require 'mediawiki-vagrant/git-update'
+ GitUpdates
+ end
+
command 'list-roles' do
require 'mediawiki-vagrant/roles'
ListRoles
diff --git a/lib/mediawiki-vagrant/git-update.rb
b/lib/mediawiki-vagrant/git-update.rb
new file mode 100644
index 0000000..78443ca
--- /dev/null
+++ b/lib/mediawiki-vagrant/git-update.rb
@@ -0,0 +1,13 @@
+class GitUpdates < Vagrant.plugin(2, :command)
+ def execute
+ if %w(-h --help).include? @argv.first
+ @env.ui.info 'Usage: vagrant git-update [-h]'
+ return 0
+ end
+
+ with_target_vms(nil, :single_target => true) do |vm|
+ opts = { :extra_args => @argv.unshift('run-git-update') }
+ vm.action :ssh, :ssh_opts => opts
+ end
+ end
+end
diff --git a/puppet/modules/mediawiki/files/run-git-update
b/puppet/modules/mediawiki/files/run-git-update
new file mode 100644
index 0000000..e916f9f
--- /dev/null
+++ b/puppet/modules/mediawiki/files/run-git-update
@@ -0,0 +1,34 @@
+#!/bin/bash
+. /etc/profile.d/puppet-managed/set_mw_install_path.sh
+
+function pull {
+ echo
+ branch=$(expr $(git symbolic-ref HEAD) : 'refs/heads/\(.*\)')
+ if [ -n "$branch" ]; then
+ remote=$(git config branch.$branch.remote)
+ if [ -n "$remote" ]; then
+ # Convert remote git url from ssh:// to anonymous https://
+ url=$(git config --get remote.$remote.url | sed -e
's!ssh://[^@]\+@!https://!g' -e 's!:29418!/r!g')
+ git pull $url
+ else
+ echo -e "\e[1;31m ************* Remote not found for branch '$branch'
in $(pwd)\e[0m"
+ fi
+ else
+ echo -e "\e[1;31m ************* Unable to get current branch in
$(pwd)\e[0m"
+ fi
+}
+
+
+cd "$MW_INSTALL_PATH"
+pull
+
+for f in extensions/*
+do
+ if [[ -d $f ]]; then
+ pushd $f > /dev/null
+ pull
+ popd > /dev/null
+ fi
+done
+
+php maintenance/update.php --quick
diff --git a/puppet/modules/mediawiki/manifests/init.pp
b/puppet/modules/mediawiki/manifests/init.pp
index f272b4e..2274965 100644
--- a/puppet/modules/mediawiki/manifests/init.pp
+++ b/puppet/modules/mediawiki/manifests/init.pp
@@ -146,6 +146,11 @@
require => Exec['configure phpunit'],
}
+ file { '/usr/local/bin/run-git-update':
+ source => 'puppet:///modules/mediawiki/run-git-update',
+ mode => '0755',
+ }
+
exec { 'update database':
command => "php ${dir}/maintenance/update.php --quick",
refreshonly => true,
--
To view, visit https://gerrit.wikimedia.org/r/98033
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I120f940cb282a4ad37c75b6025a5527a5be9d332
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits