Skip to content

Commit

Permalink
add port config discovery in azure (#964)
Browse files Browse the repository at this point in the history
* add port config discovery

* add yml in file types

---------

Co-authored-by: kaiqianyang <kaiqianyang@microsoftcom>
  • Loading branch information
KaiqianYang and kaiqianyang committed May 23, 2023
1 parent bec748c commit 7dc4670
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0"?>
<ruleset id="spring-boot-to-azure-port"
xmlns="http://windup.jboss.org/schema/jboss-ruleset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
<metadata>
<description>
Identify server port configuration in Spring Boot applications.
</description>
<dependencies>
<addon id="org.jboss.windup.rules,windup-rules-xml,3.0.0.Final"/>
</dependencies>
<sourceTechnology id="springboot"/>
<targetTechnology id="azure-spring-apps"/>
<targetTechnology id="azure-aks"/>
<targetTechnology id="azure-appservice"/>
<targetTechnology id="azure-container-apps"/>
<tag>port</tag>
</metadata>
<rules>
<rule id="spring-boot-to-azure-port-01000">
<when>
<filecontent filename="application{*}.{extensions}" pattern="{pattern}" />
</when>
<perform>
<hint title="Server port configuration found" effort="0" category-id="information">
<message>The application is setting the server port. Please be aware of potential port reliance issues during the migration process</message>
<tag>server port</tag>
</hint>
</perform>
<where param="extensions">
<matches pattern="(properties|yaml|yml)" />
</where>
<where param="pattern">
<matches pattern="(^|\s)server\.port" />
</where>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fake.fake = test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fake.fake = test
server.port = 8080
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<ruletest id="spring-boot-to-azure-port-test" xmlns="http://windup.jboss.org/schema/jboss-ruleset" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd">
<testDataPath>data/spring-boot-to-azure-port</testDataPath>
<rulePath>../spring-boot-to-azure-port.windup.xml</rulePath>
<ruleset>
<rules>
<rule id="spring-boot-to-azure-port-test-01000">
<when>
<not>
<iterable-filter size="1">
<hint-exists message="The application is setting the server port." />
</iterable-filter>
</not>
</when>
<perform>
<fail message="spring boot server port hint was not found!" />
</perform>
</rule>
</rules>
</ruleset>
</ruletest>

0 comments on commit 7dc4670

Please sign in to comment.