Extend environment:on_stop to run scripts in the current environment
At the moment,
environment:on_stop can only refer to another job for a stop action. It would be handy to be able to execute script in the same job which translates to same dynamic environment (container).
For example, if I use service
docker:dind to start docker container that does some continuous processing in one environment, I don't have a way to stop that container as running
docker stop [container-name] in another job will complain that container with that name is not found. This is because every job (afaik) starts new dind instance where docker is used.
If I can have environment definition where I can put script in
on_stop, I could do
on_stop: docker stop [container-name] which would run this script in my current dind environment, it will find my running container and stop it.
If I'm missing something that is already available to do this, please comment!