-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rules to detect eureka and config server connection string in azu…
…re (#954) * add rules to detect eureka and config server connection string in azure * update rule name * update tag to Spring Cloud Config * update test --------- Co-authored-by: kaiqianyang <kaiqianyang@microsoftcom>
- Loading branch information
1 parent
7dc4670
commit 124a9d6
Showing
9 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
rules/rules-reviewed/azure/springboot/spring-boot-to-azure-config-server.windup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0"?> | ||
<ruleset id="spring-boot-to-azure-config-server" | ||
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> | ||
This ruleset identifies Spring Cloud config server configurations 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-appservice"/> | ||
<targetTechnology id="azure-aks"/> | ||
<targetTechnology id="azure-container-apps"/> | ||
<tag>Spring Cloud Config</tag> | ||
</metadata> | ||
<rules> | ||
<rule id="spring-boot-to-azure-config-server-01000"> | ||
<when> | ||
<filecontent filename="application{*}.{extensions}" pattern="{pattern}"/> | ||
</when> | ||
<perform> | ||
<hint title="Explicit Config Server connection info found in configuration file" category-id="information" effort="0"> | ||
<message> | ||
<![CDATA[ | ||
The application uses a Spring Cloud Config Server connection string. | ||
If you are migrating to Azure Spring Apps, the connection info of Config Server will be injected upon app start. | ||
Please remove the connection info from your configuration file. Configure the Config Server after creating an Azure Spring Apps instance. | ||
]]> | ||
</message> | ||
<link title="Remove restricted configurations" href="http://aka.ms/spring-cloud-to-asa?toc=%2Fazure%2Fspring-apps%2Ftoc.json&bc=%2Fazure%2Fspring-apps%2Fbreadcrumb%2Ftoc.json&pivots=sc-standard-tier#remove-restricted-configurations"/> | ||
<link title="Prepare the Spring Cloud Config server" href="http://aka.ms/spring-cloud-to-asa?toc=%2Fazure%2Fspring-apps%2Ftoc.json&bc=%2Fazure%2Fspring-apps%2Fbreadcrumb%2Ftoc.json&pivots=sc-standard-tier#prepare-the-spring-cloud-config-server"/> | ||
<tag>Spring Cloud Config</tag> | ||
</hint> | ||
<technology-tag level="INFORMATIONAL">Spring Cloud Config</technology-tag> | ||
</perform> | ||
<where param="extensions"> | ||
<matches pattern="(properties|yaml|yml)"/> | ||
</where> | ||
<where param="pattern"> | ||
<matches pattern="spring\.config\.import|spring\.cloud\.config\.uri"/> | ||
</where> | ||
</rule> | ||
</rules> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...zure/springboot/tests/data/spring-boot-to-azure-config-server/application-prod.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
spring.cloud.config.uri=http://localhost:8888 | ||
spring.cloud.config.username=foo |
1 change: 1 addition & 0 deletions
1
...wed/azure/springboot/tests/data/spring-boot-to-azure-config-server/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
spring.config.import=file://${user.home}/spring-cloud-config-repo |
1 change: 1 addition & 0 deletions
1
...-reviewed/azure/springboot/tests/data/spring-boot-to-azure-config-server/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
spring.config.import: file://${user.home}/spring-cloud-config-repo |
1 change: 1 addition & 0 deletions
1
...s-reviewed/azure/springboot/tests/data/spring-boot-to-azure-eureka/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eureka.client.serviceUrl.defaultZone = http://localhost:8761/eureka/ |
1 change: 1 addition & 0 deletions
1
...s/rules-reviewed/azure/springboot/tests/data/spring-boot-to-azure-eureka/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
eureka.client.service-url.defaultZone: http://localhost:8761/eureka/ |
22 changes: 22 additions & 0 deletions
22
.../rules-reviewed/azure/springboot/tests/spring-boot-to-azure-config-server.windup.test.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0"?> | ||
<ruletest id="spring-boot-to-azure-config-server-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-config-server</testDataPath> | ||
<rulePath>../spring-boot-to-azure-config-server.windup.xml</rulePath> | ||
<ruleset> | ||
<rules> | ||
<rule id="spring-boot-to-azure-config-server-test-01000"> | ||
<when> | ||
<not> | ||
<iterable-filter size="3"> | ||
<hint-exists message="The application uses a Spring Cloud Config Server connection string"/> | ||
</iterable-filter> | ||
</not> | ||
</when> | ||
<perform> | ||
<fail message="Spring Cloud config server connection info hint was not found!"/> | ||
</perform> | ||
</rule> | ||
</rules> | ||
</ruleset> | ||
</ruletest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters