-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lifecycle script support via --script
on env:up
#260
base: trunk
Are you sure you want to change the base?
Conversation
This is an awesome addition @Luc45! Quick question--do you think there's any scripts we should try and prevent them running? Granted these are isolated ephemeral environments but not sure if there's anything to be careful of. |
I don't think so. Everything is dockerized, and any local directory mounted outside the disposable directory is read-only on the host. |
Cool change; given this comment though, I'm just curious about the motivation for adding this? |
It's like orchestration but for |
Right, but as you say: custom tests already use orchestration and not this. Did we need this for something, or did vendors request it? That's what I'm curious about. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good to me so far, I did see @singerb left a question on this one to provide some context around the changes which would be good to have, but otherwise happy to add in my approval.
This PR adds the ability to run scripts during environment lifecycle:
PS: I'm exposing this just on
env:up
and not onrun:e2e
as we already have the Orchestration Process in Custom Tests, and I don't want developers mistakenly using scripts instead of shared/isolated setup/teardown, which could easily break the purpose of the orchestration purpose to manage state in a compatibility test with multiple extensions.The simplest usage is as above, but you can also run a command directly:
qit env:up --script 'ls -la'
Config File Example
You can also define scripts in a
qit.yml|json
:Testing Instructions
Local script usage
setup.sh
:qit env:up --script ./setup.sh
qit env:exec cat /tmp/test_script.txt
]Direct inline command
qit env:up --script 'echo "Inline script ran" > /tmp/inline_script.log'
Config-based scripts
qit.yml
(as shown above).setup.sh
,teardown.sh
) execute on startup or shutdown.Teardown (Optional)
env_stopped
), add--script env_stopped=./teardown.sh
or define it inqit.yml
.qit env:down -v
and check logs/output to confirm the teardown script runs.