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

Add --ensure-needs option

Open Aohzan opened this issue 1 year ago • 10 comments

Is your feature request related to a problem? Please describe. Hello, is it possible, when I specify the --needs option, to run needed job only the first time and skip them after ?

Describe the solution you'd like Something like gitlab-ci-local MyJob --needs-if-missing

Additional context I have a pipeline, with a Lint job that need to install dependencies, but I don't want to download them each time, because this lasts for 1 minute

thank you

Aohzan avatar Apr 19 '23 06:04 Aohzan

Well, it's possible I would consider it extremely nice-to-have, though 😁

In general, you want your deps install job to be smart about reinstallation via caches n' other techniques.

firecow avatar Apr 19 '23 09:04 firecow

Yes but in a classic pipeline when we need to run a job again it just use what was exported by previous job, we don't need to run all needs in my case, I want to add the lint job in the pre-commit hook of my repo but I don't want users lost 1 minute for each commit, without asking them to run needs before the first commit

Aohzan avatar Apr 19 '23 11:04 Aohzan

Won't if [ -f "node_modules"]; then gitlab-ci-local eslint; fi do just that?

But yeah, I get your point.

What could be a good name for such a cli option? --ensure-needs ?

firecow avatar Apr 19 '23 13:04 firecow

yes I could check if .gitlab-ci-local/artifacts/my_needed_job exists, it will ask a custom command in the pre-commit config but I can do that otherwise --ensure-needs is a good name :+1:

Aohzan avatar Apr 19 '23 13:04 Aohzan

Hello! Still interested by the feature 😄 Thank you

Aohzan avatar Jul 21 '23 19:07 Aohzan

Hello @firecow Do you think the feature can be added in a near future ?

Aohzan avatar Nov 10 '23 08:11 Aohzan

I can't give any estimates. I only work on this project when i got time.

firecow avatar Nov 10 '23 09:11 firecow

I understand, thank you

Aohzan avatar Nov 10 '23 10:11 Aohzan

We should call the option --ensure-artifacts shouldn't we?

Because dependencies can also make a job "want" artifacts.

firecow avatar Nov 10 '23 10:11 firecow

as long as needed jobs are included it's good for me

Aohzan avatar Nov 10 '23 11:11 Aohzan