Browse Source

Merge pull request #15875 from thingsboard/openapi-spec-dynamic-ports

Reserve dynamic ports for OpenAPI spec generation to avoid port conflicts
pull/15883/head
Viacheslav Klimov 3 months ago
committed by GitHub
parent
commit
741e456a56
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 24
      application/pom.xml

24
application/pom.xml

@ -507,12 +507,31 @@
</properties> </properties>
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<!-- Reserve free ephemeral ports so concurrent openapi-spec builds (and orphaned
forks from prior failed builds) on the same CI agent don't collide on fixed ports. -->
<execution>
<id>reserve-openapi-ports</id>
<phase>initialize</phase>
<goals><goal>reserve-network-port</goal></goals>
<configuration>
<portNames>
<portName>jmx.port</portName>
<portName>http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration> <configuration>
<mainClass>org.thingsboard.server.ThingsboardServerApplication</mainClass> <mainClass>org.thingsboard.server.ThingsboardServerApplication</mainClass>
<jmxPort>9001</jmxPort> <jmxPort>${jmx.port}</jmxPort>
</configuration> </configuration>
<executions> <executions>
<execution> <execution>
@ -532,6 +551,7 @@
<arguments> <arguments>
<argument>--spring.config.name=thingsboard</argument> <argument>--spring.config.name=thingsboard</argument>
<argument>--spring.profiles.active=openapi</argument> <argument>--spring.profiles.active=openapi</argument>
<argument>--server.port=${http.port}</argument>
</arguments> </arguments>
<maxAttempts>180</maxAttempts> <maxAttempts>180</maxAttempts>
<wait>2000</wait> <wait>2000</wait>
@ -557,7 +577,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<apiDocsUrl>http://localhost:8080/v3/api-docs/thingsboard</apiDocsUrl> <apiDocsUrl>http://localhost:${http.port}/v3/api-docs/thingsboard</apiDocsUrl>
<outputFileName>openapi.json</outputFileName> <outputFileName>openapi.json</outputFileName>
<outputDir>${project.build.directory}</outputDir> <outputDir>${project.build.directory}</outputDir>
</configuration> </configuration>

Loading…
Cancel
Save