Page MenuHomePhabricator

How to make maintenance script for managing foreign resources work (Vagrant/non-Vagrant)
Closed, ResolvedPublic

Description

The maintenance script was introduced in I0f79b84ef3903756353c66d3c3ee7e492c60e648 and replaced among others 'maintenance/resources/update-ooui.sh'.
When updating OOUI in core to v0.28.1 we've run into the issue that it's not fully clear how to go forward in a non-Vagrant installation with it.

Also, in a Vagrant installation environment it returned with access errors.

Event Timeline

The script works for me, but I had to solve two problems to get it to run:

  • Enable PHP fileinfo extension (duh)
  • Run with --conf, otherwise it expects to find a LocalSettings.php file (and I have a slightly weird setup where I run MediaWiki inside a VM, but develop outside of it, so I don't have that file)

I run manageForeignResources.php with the following command now: php maintenance/resources/manageForeignResources.php --conf=includes/DefaultSettings.php update oojs-ui

After figuring this out, I followed this process to make the change https://gerrit.wikimedia.org/r/c/mediawiki/core/+/458528:

  1. Bump the version number in foreign-resources.yaml
  2. Run manageForeignResources.php so that it spits out the new integrity hash
  3. Copy-paste the integrity hash into foreign-resources.yaml
  4. Run manageForeignResources.php again, it succeeds
  5. Commit everything (including new untracked files) with the commit message copied from https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/458270 ;)

…And I forgot to run composer require oojs/oojs-ui 0.28.1. I think bringing back a script like the old update-ooui.sh to automate these steps (running composer, manageForeignResources.php, git add & commit) would be useful.

I'm using it in a non-vagrant environment (both on a plain localhost, and in mediawiki-docker-dev). Tested on PHP 7.1 (Debian 9) and PHP 7.2 (Ubuntu 16).

For releases by a vendor that publishes SRI:

  1. Add or update package in foreign-resources.yaml
  2. Run php manageForeignResources.php update <name>
  3. Add files to git and commit.

For releases without upstream SRI:

  1. Add or update package in foreign-resources.yaml (just src)
  2. Run php manageForeignResources.php make-sri <name>, and add the integrity value to yaml.
  3. Run php manageForeignResources.php update <name>.
  4. Add files to git and commit.

See also php manageForeignResources --help.

in a Vagrant installation environment it returned with access errors.

Please report the complete error. I've not encountered such error.

Run with --conf, otherwise it expects to find a LocalSettings.php file

This maintenance script uses the same way to load MediaWiki as other maintenance scripts. Do I assume correctly that this step is specific to your setup and also required for other maintenance scripts you use?

Krinkle subscribed.

…And I forgot to run composer require oojs/oojs-ui 0.28.1. I think bringing back a script like the old update-ooui.sh to automate these steps (running composer, manageForeignResources.php, git add & commit) would be useful.

Agreed. Though scripting the edit of the foreign-resources.yaml file (first for version, then for new hashes) may be challenging given it's in YAML.

Ok, turns out Homebrew installation of PHP on MacOS has fileinfo extension activated.
That became clear after some trying back and forth.

While I've unsuccessfully tried to update non-existing package oojs-ui instead of ooui in first attempts, the error message was greatly misleading:

[f043abfe850ff77992a3a63f] [no req]   Wikimedia\Rdbms\DBConnectionError from line 1180 of /Users/…/htdocs/Wikimedia/core/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)

To sum up, error catching and messages could use some attention, but script works as laid out above.

Can be set to 'resolved' from my pov…

Krinkle claimed this task.

Thanks. If you need help with those more general Vagrant/database issues, do file a task for that as well. Happy to help :)