Add the ability to run arbitrary commands on the mediawiki docker container to the mediawiki-docker cli, including the ability to shell into the container.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Update Usage for exec feature | mediawiki/tools/cli | master | +4 -1 | |
Add 'exec' feature | mediawiki/tools/cli | master | +76 -0 |
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | jeena | T246111 Command-line wrapper for interacting with core's docker-compose stack | |||
Resolved | jeena | T262370 mediawiki-docker exec feature |
Event Timeline
Change 640291 had a related patch set uploaded (by Jeena Huneidi; owner: Jeena Huneidi):
[mediawiki/tools/cli@master] Add 'exec' feature
@jeena it seems that there are issues when multiple arguments passed:
$ go run ~/go/src/gerrit.wikimedia.org/r/mediawiki/tools/cli/cmd/cli/main.go docker exec mariadb-main mysql -uroot -pmain_root_password Error: unknown shorthand flag: 'm' in -main_root_password Usage: mw docker exec [service] [command] [args] [flags]
The issue is that cobra is interpreting anything with a dash as a flag for its commands. If you use the verbose output and only try with -uroot you'll see this
$ ~/projects/cli/bin/mw docker -v2 exec mariadb-main mysql -uroot /usr/local/bin/docker-compose -p mw-core exec -u root mariadb-main mysql
There's no issue with -u because it's a flag for the exec command. -p is also a flag for the exec command, but -m isn't, so it's failing there.
I'll look for a workaround.
Does cobra stop processing flags after a -- ? (Or alternatively should stuff just be quoted in the shell?)
I just tried the -- before adding my flags and it worked. I'll add some documentation to the command.
Change 645441 had a related patch set uploaded (by Jeena Huneidi; owner: Jeena Huneidi):
[mediawiki/tools/cli@master] Update Usage for exec feature
Change 645441 abandoned by Addshore:
[mediawiki/tools/cli@master] Update Usage for exec feature
Reason:
This command is gone now