Page MenuHomePhabricator

Detect that mw core clone is clean and up to date before running multiversion-install
Open, LowPublic

Description

cf T154968

It seems, if the git repo gets in a strange state (in this case, unable to update cleanly), it then will likely cause the localisation cache to fail to build, and as such, can't create the main page with a magic word:

==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_setup]/returns: Creating main page with default content
==> default: Notice: /Stage[main]/Mediawiki/Mediawiki::Wiki[devwiki]/Exec[wiki_setup]/returns: Could not insert main page: Error: invalid magic word 'pagelanguage'
==> default: Error: /usr/local/bin/multiversion-install /vagrant/mediawiki --wiki wiki --dbname wiki --dbpass wikipassword --dbuser wikiadmin --pass vagrant --scriptpath /w --server http://dev.wiki.local.wmftest.net:8080 --confpath /vagrant/settings.d/wikis/wiki  wiki Admin

BEFORE we run multiversion-install, we should be checking that the git repo is up to date (AFAIK, we have a check for this somewhere already(?)), and that the repos is clean; ie git pull doesn't return an error due to something like "error: Your local changes to the following files would be overwritten by merge", rather than the unintuitive error we get above which is somewhat masking the problem

vagrant@mediawiki-vagrant:/vagrant/mediawiki$ git pull
remote: Counting objects: 23947, done
remote: Finding sources: 100% (2013/2013)
remote: Getting sizes: 100% (463/463)
remote: Compressing objects: 100% (3548503/3548503)
remote: Total 2013 (delta 1467), reused 1749 (delta 1335)
Receiving objects: 100% (2013/2013), 4.94 MiB | 4.26 MiB/s, done.
Resolving deltas: 100% (1467/1467), completed with 613 local objects.
From https://gerrit.wikimedia.org/r/p/mediawiki/core
   3580929e36..a2cc0fd347  master              -> origin/master
   2bac17fe80..36b636dcb6  REL1_27             -> origin/REL1_27
   48cd4b565c..bd2f326a46  REL1_28             -> origin/REL1_28
   1f9ea809b3..c22353b6a9  fundraising/REL1_27 -> origin/fundraising/REL1_27
   613cca21e0..c82525cdce  wmf/1.29.0-wmf.5    -> origin/wmf/1.29.0-wmf.5
   30d21455c4..8187b6e5b1  wmf/1.29.0-wmf.6    -> origin/wmf/1.29.0-wmf.6
   23bde0e33f..d5eae5382d  wmf/1.29.0-wmf.7    -> origin/wmf/1.29.0-wmf.7
 * [new branch]            wmf/1.29.0-wmf.8    -> origin/wmf/1.29.0-wmf.8
Updating d642313763..a2cc0fd347
error: Your local changes to the following files would be overwritten by merge:
	includes/parser/Parser.php
	languages/i18n/ar.json
	languages/i18n/ba.json
	languages/i18n/be-tarask.json
	languages/i18n/bn.json
	languages/i18n/br.json
	languages/i18n/ce.json
	languages/i18n/cs.json
	languages/i18n/de.json
	languages/i18n/el.json
	languages/i18n/en.json
	languages/i18n/eo.json
	languages/i18n/es.json
	languages/i18n/fi.json
	languages/i18n/fr.json
	languages/i18n/he.json
	languages/i18n/ia.json
	languages/i18n/io.json
	languages/i18n/ko.json
	languages/i18n/ku-latn.json
	languages/i18n/lo.json
	languages/i18n/lv.json
	languages/i18n/mk.json
	languages/i18n/mr.json
	languages/i18n/my.json
	languages/i18n/nb.json
	languages/i18n/nl.json
	languages/i18n/or.json
	languages/i18n/pl.json
	languages/i18n/ps.json
	languages/i18n/pt-br.json
	languages/i18n/pt.json
	languages/i18n/qqq.json
	languages/i18n/ru.json
	languages/i18n/sah.json
	languages/i18n/sl.json
	languages/i18n/udm.json
	languages/i18n/zh-hans.json
	languages/messages/MessagesEn.php
	tests/parser/parserTests.txt
	tests/phpunit/includes/user/UserTest.php
Please commit your changes or stash them before you merge.
Aborting
vagrant@mediawiki-vagrant:/vagrant/mediawiki$