gitlab-ci-local icon indicating copy to clipboard operation
gitlab-ci-local copied to clipboard

Optional flag to avoid restarting services at each run

Open ebousse opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

I have a pipeline where a particular task requires multiple services to be started (using the services declaraion). Starting these services takes time, thus this task is always rather long to run.

Yet, in my case, these services are stateless, therefore a lot of time could be gained if these services were not restarted each time the pipeline is executed − even though this cannot be avoided in a real Gitlab runner context, and I am OK with that.

Describe the solution you'd like

I would find it very usefull to have a flag that would tell gitlab-ci-local :

  • when services should normally be started, to check first whether they are already started,
  • when services should normally be stopped, to not stop them.

Note that I am conscious that this hypothetical flag would make gitlab-ci-local not behave the same as a normal Gitlab runner. Yet I think it would be very useful for a local usage in cases similar to mine.

Describe alternatives you've considered

I can try to make a pipeline relying on a docker-compose.yml file that should be up when the task starts, but I have tried and found it very difficult to make it work in a Gitlab runner context (using dind). By comparison, I believe the services declaration is ideal, cleaner, and more adapted to this level of abstraction.

ebousse avatar Sep 15 '22 12:09 ebousse

We are not likely to implement this, but a PR will be taken seriously. I'm marking it nice-to-have.

firecow avatar Sep 16 '22 05:09 firecow