Run direct commands with `tric shell`
sc0ttkclark opened this issue · comments
From what I understand, tric shell
loads up an interactive shell that you can type in commands for just about anything. What I'd really like to do is to have a GitHub action call a command (outside of Codeception and NPM) which would rely on the same config that tric shell
uses for which containers it loads up. I just want to do a one-liner call and have it run that and return the response.
Leaving this here for future me or future you to work on, something like tric shell [command here]
which would just pass it through instead of load up the interactive shell.
@sc0ttkclark could you provide some examples of the commands you would like to run with such support? I fail to grasp the use cases, but that is my lack of imagination...
I have some performance tests that run via their own PHP process which I want to be able to automate with Tric + GitHub actions. See https://github.com/pods-framework/pods/blob/release/2.8/tests/performance/Pods.php which is using https://github.com/bvanhoekelen/performance
Thanks for clarifying.
The shell
command will target a service, the codeception
one by default, to open a bash
shell; I would not modify that one and would rather create a new command.
I would propose "borrowing" a piece of API from Docker and docker-compose and use exec
to execute a command in a container.
E.g. run a the vendor/bin/some-script
script in the codeception
container:
tric exec codeception -- vendor/bin/some-script --some-script --options=foo
The use of --
would mark the end of the tric
command and the start of the command arguments and options, it can come handy in cases like this one:
tric exec php -- php vendor/bin/some-script.php --flag --option=foo --option-2=bar
The first php
means "the php service", the second php
means "the php binary in the php container".
The exec
command would still set up the tric environment and resolve the targeted container dependencies but it would alter, in essence, the container entry point and command.
That sounds great to me!
Deal, then. I will work on this command as soon as I get a chance to and update this issue with relevant information.
Good recommendation. We've added slic exec "<command>"
to slic
as of version 1.1.1 💃