Commit 489dc8c8 authored by Addshore's avatar Addshore 🏄
Browse files

dev: Wrap execs in sh -c to enable env vars

parent a0d725ef
......@@ -448,7 +448,8 @@ var mwddMediawikiExecCmd = &cobra.Command{
Example: ` exec bash # Run bash as your system user
exec --user root -- bash # Run bash as root
exec -- composer phpunit:unit # Run a composer command (php unit tests)
exec -- composer composer phpunit tests/phpunit/unit/includes/XmlTest.php # Run a single test
exec -- composer phpunit tests/phpunit/unit/includes/XmlTest.php # Run a single test
exec -- MW_DB=other composer phpunit tests/phpunit/unit/includes/XmlTest.php # Run a single test for another database
exec -- php maintenance/update.php --quick # Run a MediaWiki maintenance script`,
Short: "Executes a command in the MediaWiki container",
Run: func(cmd *cobra.Command, args []string) {
......
......@@ -24,6 +24,7 @@ import (
"os"
gosignal "os/signal"
"runtime"
"strings"
"time"
"gerrit.wikimedia.org/r/mediawiki/tools/cli/internal/exec"
......@@ -69,7 +70,7 @@ func (m MWDD) DockerExec(command DockerExecCommand) {
Tty: true,
WorkingDir: command.WorkingDir,
User: command.User,
Cmd: command.Command,
Cmd: []string{"/bin/sh", "-c", strings.Join(command.Command, " ")},
}
ctx := context.Background()
......
......@@ -14,6 +14,9 @@ trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
# Create
./bin/mw docker mediawiki create
# Make sure that exec generally works as expected
./bin/mw docker mediawiki exec -- FOO=bar env | grep FOO
# Validate the basic stuff
./bin/mw docker docker-compose ps
./bin/mw docker env list
......
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