melos icon indicating copy to clipboard operation
melos copied to clipboard

request: dynamic runPubGetInParallel

Open tomassasovsky opened this issue 1 year ago • 4 comments

Is there an existing feature request for this?

  • [X] I have searched the existing issues.

Command

No response

Description

The flag runPubGetInParallel should accept:

  • true
  • false
  • auto

The option "auto" would fallback to false when the machine is a CI instance. This can be checked with the environment variable CI

Resources:

Reasoning

Locally, running pub get in parallel is very useful and not at all prone to resulting in a broken pubspec.lock. On CI processes, however, it can break easily. Modifying this manually is very annoying.

Additional context and comments

No response

tomassasovsky avatar Jul 18 '23 16:07 tomassasovsky

I would also add that the current default value of true can cause a lot of headaches for everyone who starts using melos and starts running into issues on the CI as the errors caused by parallel pub get runs at first glance seem to have nothing to do with melos.

This "auto" option could be the default option solving the above problem elegantly.

szugyi avatar Jun 18 '24 13:06 szugyi

It sounds like a good idea, if anyone is keen on implementing it, feel free to submit a PR. :)

spydon avatar Jun 18 '24 14:06 spydon

@spydon I was thinking about this issue.

The reason we want a flag like this is the fact that on CI machines melos seem to get into weird race conditions during running pub get in parallel. But why is that? What makes running pub get in parallel on a local machine safe, and fragile on CI?

I think this is what should be fixed. Adding this auto flag is like accepting this as a fact, like it was anticipated to have issues on CI.

szugyi avatar Jul 01 '24 08:07 szugyi

But why is that? What makes running pub get in parallel on a local machine safe, and fragile on CI?

If you want to investigate it, feel free, I haven't been able to come to any conclusions about when it is failing and when it is not (it works most of the time). There are multiple other packages suffering from the same problem too, like spec for example.

Once the workspace feature lands I'm sure this won't be a problem anymore: http://flutter.dev/go/pub-workspace

spydon avatar Jul 01 '24 09:07 spydon