Page MenuHomePhabricator

Install php-gd for BlueSpiceExtendedStatistics extension tests
Closed, ResolvedPublic

Description

In the following commit I try to require phpoffice/phpspreadsheet in the composer.json to enable xsl export of statistics:
https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/BlueSpiceExtendedStatistics/+/545543/

composer.json

"require": {
	"composer/installers": "~1.0",
	"phpoffice/phpspreadsheet": "~1.6"
},

I also added the platform section to extension.json with all the php extensions phpspreadsheet reqires:

"requires": {
	"MediaWiki": ">= 1.35.0",
	"extensions": {
		"BlueSpiceFoundation": ">= 3.3",
		"BlueSpiceExtendedSearch": ">= 3.3"
	},
	"platform": {
		"php": ">= 7.2",
		"ext-ctype": "*",
		"ext-dom": "*",
		"ext-gd": "*",
		"ext-iconv": "*",
		"ext-fileinfo": "*",
		"ext-libxml": "*",
		"ext-mbstring": "*",
		"ext-SimpleXML": "*",
		"ext-xml": "*",
		"ext-xmlreader": "*",
		"ext-xmlwriter": "*",
		"ext-zip": "*",
		"ext-zlib": "*"
	}
},

But the tests fail due to missing the php-gd extension
mwgate-composer-php72-docker https://integration.wikimedia.org/ci/job/mwgate-composer-php72-docker/397/console

15:02:04 Your requirements could not be resolved to an installable set of packages.
15:02:04 
15:02:04   Problem 1
15:02:04     - phpoffice/phpspreadsheet 1.9.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
15:02:04     - phpoffice/phpspreadsheet 1.8.2 requires ext-gd * -> the requested PHP extension gd is missing from your system.
15:02:04     - phpoffice/phpspreadsheet 1.8.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.
15:02:04     - phpoffice/phpspreadsheet 1.8.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
15:02:04     - phpoffice/phpspreadsheet 1.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
15:02:04     - phpoffice/phpspreadsheet 1.6.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
15:02:04     - Installation request for phpoffice/phpspreadsheet ~1.6 -> satisfiable by phpoffice/phpspreadsheet[1.6.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0].
15:02:04 
15:02:04   To enable extensions, verify that they are enabled in your .ini files:
15:02:04     - /etc/php/7.2/cli/php.ini
15:02:04     - /etc/php/7.2/cli/conf.d/10-opcache.ini
15:02:04     - /etc/php/7.2/cli/conf.d/10-pdo.ini
15:02:04     - /etc/php/7.2/cli/conf.d/15-xml.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-bcmath.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-calendar.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-ctype.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-curl.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-dba.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-dom.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-exif.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-fileinfo.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-ftp.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-gettext.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-gmp.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-iconv.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-igbinary.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-json.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-mbstring.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-pdo_sqlite.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-phar.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-posix.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-readline.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-redis.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-shmop.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-simplexml.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-sockets.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-sqlite3.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-sysvmsg.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-sysvsem.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-sysvshm.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-tokenizer.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-wddx.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-xmlreader.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-xmlwriter.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-xsl.ini
15:02:04     - /etc/php/7.2/cli/conf.d/20-zip.ini
15:02:04   You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Is there a way to make php-gd available?

Event Timeline

In another extension phpspreadsheet is istalled as well and it just works fine within the ci tests:

BlueSpiceUEModuleTable2Excel:
https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/BlueSpiceUEModuleTable2Excel/+/546927/

Tests
https://integration.wikimedia.org/ci/job/quibble-composer-mysql-php72-docker/6432/console

Am I missiing something here?

I'm pretty sure php-gd is installed in CI generally; what job is failing? Or is this now fixed?

it is still failing with the message:

09:19:22   Problem 1
09:19:22     - phpoffice/phpspreadsheet 1.9.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.

mwgate-composer-php72-docker: https://integration.wikimedia.org/ci/job/mwgate-composer-php72-docker/1851/console

The job uses docker-registry.wikimedia.org/releng/composer-test-php72:0.2.1-s8 which inherits from composer-php72 php72. The Dockerfile states that php7.2-gd can not be installed:

dockerfiles/php72/Dockerfile.template
FROM {{ "ci-stretch" | image_tag }}
  
# Align with SRE provided packages
COPY wikimedia-php72.list /etc/apt/sources.list.d/wikimedia-php72.list

# zip is needed for composer to install things from dist
# others are libraries/MediaWiki related
# php7.2-gd isn't installable, so it's skipped.
...

If I try locally:

$ docker run --rm -it --user=root --entrypoint=bash  docker-registry.wikimedia.org/releng/php72:latest
# apt update
# apt-cache policy php7.2-gd
php7.2-gd:
  Installed: (none)
  Candidate: 7.2.26-1+0~20191218.33+debian9~1.gbpb5a340+wmf1
  Version table:
     7.2.26-1+0~20191218.33+debian9~1.gbpb5a340+wmf1 500
        500 http://apt.wikimedia.org/wikimedia stretch-wikimedia/component/php72 amd64 Packages

# apt install php7.2-gd
...

# php -m
gd
#

The Dockerfile for php71 has the same comment but php7.1-gd installs just fine.

So should be straightforward to add the packages to the php images and rebuild all the dependent containers.

Change 583099 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[integration/config@master] dockerfiles: Install php-gd everywhere and cascade

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

Change 583099 merged by jenkins-bot:
[integration/config@master] dockerfiles: Install php-gd everywhere and cascade

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

Mentioned in SAL (#wikimedia-releng) [2020-03-24T16:16:44Z] <James_F> Docker: Publishing new PHP images with GD installed T236261

Change 583101 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[integration/config@master] jjb: Upgrade everything to docker images with php-gd

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

Change 583101 merged by jenkins-bot:
[integration/config@master] jjb: Upgrade everything to docker images with php-gd

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