Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/115193
Change subject: Setup jenkins configuration
......................................................................
Setup jenkins configuration
Change-Id: I8ab4ae49fba1e71aa13c151559347e065f47a2c7
---
M CirrusSearch.php
A tests/jenkins/Jenkins.php
A tests/jenkins/cleanSetup.php
3 files changed, 140 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/93/115193/1
diff --git a/CirrusSearch.php b/CirrusSearch.php
index e39d162..755c773 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -254,6 +254,7 @@
$wgAutoloadClasses['CirrusSearch\Connection'] = $includes . 'Connection.php';
$wgAutoloadClasses['CirrusSearch\DeletePagesJob'] = $includes .
'DeletePagesJob.php';
$wgAutoloadClasses['CirrusSearch\ElasticsearchIntermediary'] = $includes .
'ElasticsearchIntermediary.php';
+$wgAutoloadClasses['CirrusSearch\ForceSearchIndex'] = __DIR__ .
'/maintenance/forceSearchIndex.php';
$wgAutoloadClasses['CirrusSearch\Hooks'] = $includes . 'Hooks.php';
$wgAutoloadClasses['CirrusSearch\LinksUpdateJob'] = $includes .
'LinksUpdateJob.php';
$wgAutoloadClasses['CirrusSearch\LinksUpdateSecondaryJob'] = $includes .
'LinksUpdateSecondaryJob.php';
@@ -305,3 +306,10 @@
$wgJobClasses[ 'cirrusSearchLinksUpdateSecondary' ] =
'CirrusSearch\LinksUpdateSecondaryJob';
$wgJobClasses[ 'cirrusSearchMassIndex' ] = 'CirrusSearch\MassIndexJob';
$wgJobClasses[ 'cirrusSearchOtherIndex' ] = 'CirrusSearch\OtherIndexJob';
+
+/**
+ * Jenkins configuration required to get all the browser tests passing cleanly.
+ */
+if ( isset( $wgWikimediaJenkinsCI ) && $wgWikimediaJenkinsCI === true ) {
+ require( __DIR__ . '/tests/jenkins/Jenkins.php' );
+}
diff --git a/tests/jenkins/Jenkins.php b/tests/jenkins/Jenkins.php
new file mode 100644
index 0000000..96b432e
--- /dev/null
+++ b/tests/jenkins/Jenkins.php
@@ -0,0 +1,82 @@
+<?php
+namespace CirrusSearch\Jenkins;
+
+/**
+ * Sets up configuration required to run the browser tests on Jenkins.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+// All of this has to be done at setup time so it has the right globals. No
putting
+// it in a class or anything.
+
+// Configuration we have to override before installing Cirrus but only if
we're using
+// Jenkins as a prototype for development.
+if ( !isset( $wgRedisPassword ) ) {
+ $wgRedisPassword = 'notsecure';
+}
+
+// Extra Cirrus stuff for Jenkins
+$wgAutoloadClasses[ 'CirrusSearch\Jenkins\CleanSetup' ] = __DIR__ .
'/cleanSetup.php';
+$wgHooks[ 'LoadExtensionSchemaUpdates' ][] =
'CirrusSearch\Jenkins\Jenkins::installCleanSetup';
+
+// Dependencies
+require( "$IP/extensions/Elastica/Elastica.php" );
+require( "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php" );
+require( "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php" );
+require( "$IP/extensions/PdfHandler/PdfHandler.php" );
+
+// Configuration
+$wgSearchType = 'CirrusSearch';
+$wgOggThumbLocation = '/usr/bin/oggThumb';
+$wgGroupPermissions[ '*' ][ 'deleterevision' ] = true;
+$wgFileExtensions[] = 'pdf';
+$wgCapitalLinks = false;
+$wgUseInstantCommons = true;
+$wgEnableUploads = true;
+$wgJobTypeConf['default'] = array(
+ 'class' => 'JobQueueRedis',
+ 'order' => 'fifo',
+ 'redisServer' => 'localhost',
+ 'checkDelay' => true, # The magic bit.
+ 'redisConfig' => array(
+ 'password' => $wgRedisPassword,
+ ),
+);
+$wgJobQueueAggregator = array(
+ 'class' => 'JobQueueAggregatorRedis',
+ 'redisServer' => 'localhost',
+ 'redisConfig' => array(
+ 'password' => $wgRedisPassword,
+ ),
+);
+
+// Extra helpful configuration but not really required
+$wgShowExceptionDetails = true;
+$wgCirrusSearchShowScore = true;
+
+class Jenkins {
+ /**
+ * Installs a maintenance script the provides a clean Elasticsearch
index for testing.
+ * @param DatabaseUpdater $updater database updater
+ * @return bool true so we let other extensions install more
maintenance actions
+ */
+ public static function installCleanSetup( $updater ) {
+ print('foo');
+ $updater->addPostDatabaseUpdateMaintenance(
'CirrusSearch\Jenkins\CleanSetup');
+ return true;
+ }
+}
diff --git a/tests/jenkins/cleanSetup.php b/tests/jenkins/cleanSetup.php
new file mode 100644
index 0000000..86b2cb0
--- /dev/null
+++ b/tests/jenkins/cleanSetup.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace CirrusSearch\Jenkins;
+use \Maintenance;
+
+/**
+ * Calls maintenance scripts properly to get an empty and configured index and
+ * anything else required for browser tests to pass.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+$IP = getenv( 'MW_INSTALL_PATH' );
+if( $IP === false ) {
+ $IP = __DIR__ . '/../../../..';
+}
+require_once( "$IP/maintenance/Maintenance.php" );
+
+class CleanSetup extends Maintenance {
+ public function execute() {
+ $child = $this->runChild(
'CirrusSearch\UpdateSearchIndexConfig' );
+ $child->mOptions[ 'startOver' ] = true;
+ $child->execute();
+ $child = $this->runChild( 'CirrusSearch\ForceSearchIndex' );
+ $child->mOptions[ 'forceUpdate' ] = true;
+ $child->mOptions[ 'skipLinks' ] = true;
+ $child->mOptions[ 'indexOnSkip' ] = true;
+ $child->execute();
+ $child = $this->runChild( 'CirrusSearch\ForceSearchIndex' );
+ $child->mOptions[ 'forceUpdate' ] = true;
+ $child->mOptions[ 'skipParse' ] = true;
+ $child->execute();
+ }
+}
+
+$maintClass = "CirrusSearch\Jenkins\CleanSetup";
+require_once RUN_MAINTENANCE_IF_MAIN;
--
To view, visit https://gerrit.wikimedia.org/r/115193
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ab4ae49fba1e71aa13c151559347e065f47a2c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits