🚧 This instance is under construction; expect occasional downtime. Runners available in /repos. Questions? Ask in #wikimedia-gitlab on libera.chat, or under GitLab on Phabricator.

Commit 33e1d1dc authored by Addshore's avatar Addshore 🏄
Browse files

Correctly check composer before install

parent 0a75b0b9
......@@ -89,7 +89,7 @@ integration:
- TEST: docker-mw-mysql-suspend-resume-destroy.sh
before_script:
# libc6-compat needed because https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host
- apk add --no-cache libc6-compat bash docker-compose curl
- apk add --no-cache libc6-compat bash docker-compose curl composer
- ./tests/cache-mediawiki.sh
- ./tests/setup.sh
script:
......
......@@ -208,7 +208,7 @@ var mwddMediawikiInstallCmd = &cobra.Command{
The process hidden within this command is:
- Ensure we know where MediaWiki is
- Ensure a LocalSettings.php file exists with the shim needed by this development environemnt
- Ensure composer dependencies are up to date, or run composer install
- Ensure composer dependencies are up to date, or run composer install & update
- Move LocalSettings.php to a temporary location, as MediaWiki can't install with it present
- Wait for any needed databases to be ready
- Run install.php
......@@ -281,16 +281,17 @@ The process hidden within this command is:
// Check composer dependencies are up to date
checkComposer := func() {
// TODO make use of composer caches
// overrideConfig is a hack https://phabricator.wikimedia.org/T291613
// If this gets merged into Mediawiki we can remvoe it here https://gerrit.wikimedia.org/r/c/mediawiki/core/+/723308/
composerErr := mwdd.DefaultForUser().ExecNoOutput("mediawiki", []string{
"php", "/var/www/html/w/maintenance/checkComposerLockUpToDate.php",
"php", "-r", "define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); require_once('/var/www/html/w/maintenance/checkComposerLockUpToDate.php');",
},
exec.HandlerOptions{}, User)
if composerErr != nil {
fmt.Println("Composer check failed:", composerErr)
prompt := promptui.Prompt{
IsConfirm: true,
Label: "Composer dependencies are not up to date, do you want to composer install?",
Label: "Composer dependencies are not up to date, do you want to composer install & update?",
}
_, err := prompt.Run()
if err == nil {
......@@ -299,6 +300,11 @@ The process hidden within this command is:
Command: []string{"composer", "install", "--ignore-platform-reqs", "--no-interaction"},
User: User,
})
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "mediawiki",
Command: []string{"composer", "update", "--ignore-platform-reqs", "--no-interaction"},
User: User,
})
} else {
fmt.Println("Can't install without up to date composer dependencies")
os.Exit(1)
......@@ -397,6 +403,7 @@ The process hidden within this command is:
"--quick",
}, exec.HandlerOptions{}, "nobody")
}
// TODO if update fails, still output the install message section, BUT tell them they need to fix the issue and run update.php
runUpdate()
fmt.Println("")
......
......@@ -21,5 +21,8 @@ if [[ ! -f mediawiki/.gitlab-ci.cache.20210809-02 ]]; then
touch mediawiki/.gitlab-ci.cache.20210809-02
fi
# Always do a composer update (even when cached) to ensure deps are as up to date as possible
composer update --working-dir=mediawiki --no-interaction --no-progress --ignore-platform-reqs
# Always remove files that may have been left behind by previous tests and may get in the way?
rm -f mediawiki/LocalSettings.php
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment