fix(ci): prevent parallel print-config commands #992
Merged
+96
−51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Received an error report from customer with large Nx monorepo and GitLab CI/CD. Although
nx run-many -t code-pushupcommand succeeded on all their projects, there was an Nx project graph error when trying to read their report files by running manynx run <project>:code-pushup --skipNxCache -- print-config --output=code-pushup.<random>.config.jsonprocesses in parallel (implementation usesPromise.all). It appears that Nx struggles to process all these commands at once.CI logs
Changed implementation so that
print-configis run sequentially for each project. It should be a relatively fast command (doesn't execute plugin runners), so it shouldn't have a noticeable impact on overall performance.Also added a helper function to make sequential promises as easy to use as
Promise.all-reducewithasyncaccumulator is quite verbose. I decided to call itasyncSequential, but feel free to suggest a better name.