firecow / gitlab-ci-local

Tired of pushing to test your .gitlab-ci.yml?
MIT License
2.28k stars 128 forks source link

Decouple from cwd #1067

Open avoidik opened 9 months ago

avoidik commented 9 months ago

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

I would like to keep all gitlab-ci-local related data outside of my git projects, completely separate. Which seems to be an impossible goal due to the common pattern to bind almost all path operations to the cwd (${cwd}/${stateDir}/..., ${cwd}/${file}, git, etc.).

Describe the solution you'd like

I would like to have an option to be able to decouple from the cwd. The idea here is that GCL should take only a source code from the particular directory I could have specified, while everything else, like dotfiles, variables.yaml, stateDir, even gitlab-ci-local.yml itself, sits in another directory, outside of a git project. Something like --git-dir CLI option, maybe.

Describe alternatives you've considered

I was trying to combine different CLI options (--home, --state-dir, --cwd, --file) in attempt to achieve what I want, but I was unable to do so.

Additional context

N/A

firecow commented 9 months ago

We could implement code that allows --state-dir to be an absolute path...

Would that be sufficient for your use case?

gitlab-ci-local --state-dir /home/me/project35-gitlab-ci-local
avoidik commented 9 months ago

It looks good to me, I guess if we are going to follow this pattern the --file CLI should be also able to accept absolute path.