Browse Source

Serialize msa yarn modules to fix intermittent `tsc: not found` under -T

Under `mvn -T<n>` with the three yarn-using modules (ui-ngx,
msa/web-ui, msa/js-executor), concurrent yarn 1.x processes contend
on the shared `~/.cache/yarn`. The `--mutex network` flag was applied
only to `yarn install`, so `yarn run pkg` could overlap with another
module's install. Intermittent failures observed on CI:
`/bin/sh: 1: tsc: not found` during `yarn run pkg`, caused by
incomplete typescript extraction into per-module node_modules.

Fix at two layers:

1. Maven reactor chain (primary): add reactor-only pom <dependency>
   entries (type=pom, scope=provided, wildcard exclusions) to form
       ui-ngx -> msa/web-ui -> msa/js-executor
   so the MultiThreadedBuilder schedules them strictly serial,
   regardless of -T thread count. msa/web-ui already had a real
   dependency on ui-ngx; only one new fake link was needed.

2. Yarn-level mutex (defense in depth): add `--mutex network` to
   `yarn run pkg` (msa/web-ui, msa/js-executor) and
   `yarn run build:prod` (ui-ngx), so single-module builds outside the
   reactor chain (`mvn -pl msa/<module>`) still serialize against any
   other yarn process on the agent.

Comment in msa/pom.xml updated: the previous "Modules order is
important..." note was misleading - module order in the reactor does
not enforce serialization under -T; the dependency edges do.
pull/15561/head
Sergey Matvienko 5 months ago
parent
commit
fd4a5b36f6
  1. 25
      msa/js-executor/pom.xml
  2. 11
      msa/pom.xml
  3. 2
      msa/web-ui/pom.xml
  4. 2
      ui-ngx/pom.xml

25
msa/js-executor/pom.xml

@ -52,6 +52,29 @@
<type>exe</type> <type>exe</type>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!--
Reactor-only ordering dep (NOT a real classpath dependency).
Forces `mvn -T<n>` to serialize this module after web-ui so that
no two `yarn install` / `yarn run pkg` invocations can overlap on
the same agent. Concurrent yarn 1.x processes share ~/.cache/yarn
and have intermittently produced `tsc: not found` failures during
yarn pkg (incomplete typescript extraction in node_modules).
The chain is: ui-ngx -> msa/web-ui -> msa/js-executor.
type=pom + provided + wildcard exclusions keep nothing on the classpath.
-->
<dependency>
<groupId>org.thingsboard.msa</groupId>
<artifactId>web-ui</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -90,7 +113,7 @@
</goals> </goals>
<phase>compile</phase> <phase>compile</phase>
<configuration> <configuration>
<arguments>run pkg</arguments> <arguments>--mutex network run pkg</arguments>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

11
msa/pom.xml

@ -44,7 +44,16 @@
</properties> </properties>
<modules> <modules>
<!--Modules order is important to speedup parallel build and avoid yarn pgk parallel execution--> <!--
Module order below is informational only. Yarn-using modules
(web-ui, js-executor) are serialized via reactor-only
<dependency> entries in their own poms, forming the chain
ui-ngx -> web-ui -> js-executor. This prevents
concurrent yarn install / yarn run pkg invocations under `mvn -T<n>`,
which previously caused intermittent `tsc: not found` failures
(incomplete typescript extraction in node_modules from racing
yarn 1.x processes against the shared ~/.cache/yarn).
-->
<module>tb</module> <module>tb</module>
<module>web-ui</module> <module>web-ui</module>
<module>vc-executor</module> <module>vc-executor</module>

2
msa/web-ui/pom.xml

@ -99,7 +99,7 @@
</goals> </goals>
<phase>compile</phase> <phase>compile</phase>
<configuration> <configuration>
<arguments>run pkg</arguments> <arguments>--mutex network run pkg</arguments>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

2
ui-ngx/pom.xml

@ -106,7 +106,7 @@
<goal>yarn</goal> <goal>yarn</goal>
</goals> </goals>
<configuration> <configuration>
<arguments>run build:prod</arguments> <arguments>--mutex network run build:prod</arguments>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

Loading…
Cancel
Save