Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more azure rules #931

Merged
merged 6 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions rules/rules-reviewed/azure/azure-logging.windup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0"?>
<ruleset id="azure-logging"
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 detects logging configurations that may be problematic when migrating an application to a cloud environment.
</description>
<dependencies>
<addon id="org.jboss.windup.rules,windup-rules-javaee,3.0.0.Final"/>
<addon id="org.jboss.windup.rules,windup-rules-java,3.0.0.Final"/>
</dependencies>
<sourceTechnology id="eap" versionRange="[7,8)" />
<sourceTechnology id="springboot"/>
<targetTechnology id="azure-spring-apps"/>
<targetTechnology id="azure-appservice"/>
<targetTechnology id="azure-aks"/>
<targetTechnology id="azure-container-apps"/>
<tag>logging</tag>
</metadata>
<rules>
<rule id="azure-logging-0000">
<when>
<or>
<filecontent filename="logback{*}.{extension}" pattern="{fileAppenderPattern}"/>
<filecontent filename="log4j{*}.{extension}" pattern="{fileAppenderPattern}"/>
<filecontent filename="log{4j,4j2}{*}.{extension}" pattern="{log4j2FileAppenderPattern}"/>
<javaclass references="org.apache.{*}log4j.{*}FileAppender{*}">
<location>IMPORT</location>
</javaclass>
<javaclass references="java.util.logging.FileHandler{*}">
<location>IMPORT</location>
</javaclass>
<javaclass references="ch.qos.logback.core.FileAppender">
<location>IMPORT</location>
</javaclass>
<javaclass references="org.pmw.tinylog.writers.FileWriter">
<location>IMPORT</location>
</javaclass>
</or>
</when>
<perform>
<iteration>
<when>
<not>
<has-hint />
</not>
</when>
<perform>
<hint title="Don't log to file system" effort="1" category-id="cloud-mandatory">
<message>
Logging to the file system is not recommended when running applications in the cloud.

Instead, use a console appender to log to standard output.
</message>
<link href=" http://aka.ms/spring-cloud-to-asa?toc=%2Fazure%2Fspring-apps%2Ftoc.json&amp;bc=%2Fazure%2Fspring-apps%2Fbreadcrumb%2Ftoc.json&amp;pivots=sc-standard-tier#ensure-console-logging-and-configure-diagnostic-settings" title="Enable console logging in migration"/>
<link href="https://learn.microsoft.com/azure/spring-apps/how-to-write-log-to-custom-persistent-storage" title="How to use Logback to write logs to custom persistent storage"/>
<tag>logging</tag>
</hint>
<technology-tag level="INFORMATIONAL">Logging to file system</technology-tag>
</perform>
</iteration>
</perform>
<where param="fileAppenderPattern">
<matches pattern="(?i)((Daily)?Rolling)?FileAppender"/>
</where>
<where param="log4j2FileAppenderPattern">
<matches pattern="(?i)(type\s*=\s*&quot;?((Daily)?Rolling)?File&quot;?)|&lt;\/((Daily)?Rolling)?File&gt;"/>
</where>
<where param="extension">
<matches pattern="(xml|properties)"/>
</where>
</rule>
</rules>
</ruleset>
51 changes: 51 additions & 0 deletions rules/rules-reviewed/azure/azure-os-specific.windup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0"?>
<ruleset id="azure-os-specific" 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 is a ruleset for Windows operating system specific rules while migrating to Linux operating system.
</description>
<dependencies>
<addon id="org.jboss.windup.rules,windup-rules-javaee,2.4.0.Final" />
<addon id="org.jboss.windup.rules,windup-rules-java,2.4.0.Final" />
</dependencies>
<!-- version ranges applied to from and to technologies -->
<sourceTechnology id="eap" versionRange="[7,8)" />
<sourceTechnology id="springboot"/>
<targetTechnology id="azure-spring-apps"/>
<targetTechnology id="azure-appservice"/>
<targetTechnology id="azure-aks"/>
<targetTechnology id="azure-container-apps"/>
<tag>ms-windows</tag>
</metadata>
<rules>
<rule id="azure-os-specific-00001">
<when>
<filecontent filename="{*}.{extensions}" pattern="{pattern}" />
</when>
<perform>
<hint title="Windows file system path" effort="1" category-id="mandatory">
<message>This file system path is Microsoft Windows platform dependent. It needs to be replaced with a Linux-style path.</message>
<tag>ms-windows</tag>
</hint>
</perform>
<where param="extensions">
<matches pattern="(java|properties|jsp|jspf|tag|xml|txt)" />
</where>
<where param="pattern">
<matches pattern="(\W|\s|^)(?:[a-zA-Z]\:|\\\\[\w\s\.]+)([\\\/][^\n\t]+)+" />
</where>
</rule>
<rule id="azure-os-specific-00002">
<when>
<file filename="{*}.dll"/>
</when>
<perform>
<hint title="Dynamic-Link Library (DLL)" effort="5" category-id="mandatory">
<message>This Dynamic-Link Library is Microsoft Windows platform dependent. It needs to be replaced with a Linux-style shared library.</message>
<tag>ms-windows</tag>
</hint>
</perform>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0"?>
<ruleset id="spring-boot-to-azure-apm"
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 Application Performance Management dependencies.
</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>apm</tag>
</metadata>
<rules>
<rule id="spring-boot-to-azure-apm-01000">
<when>
<or>
<project>
<artifact groupId="com.microsoft.azure" artifactId="{*}applicationinsights{*}"/>
</project>
<project>
<artifact groupId="{*}newrelic{*}" artifactId="{*}"/>
</project>
<project>
<artifact groupId="{*}elastic.apm{*}" artifactId="{*}"/>
</project>
<project>
<artifact groupId="{*}dynatrace.oneagent{*}" artifactId="{*}"/>
</project>
</or>
</when>
<perform>
<hint title="APM" category-id="information" effort="0">
<message>
<![CDATA[
The application uses an Application Performance Management (APM) tool.

Azure Spring Apps supports integration with Application Insights, New Relic, Elastic APM, Dynatrace, and AppDynamics.
You can configure the APM tool with ease in migration to Azure Spring Apps.
]]>
</message>
<link title="Spring Boot to Azure - identify APM dependencies" href="http://aka.ms/spring-cloud-to-asa?pivots=sc-standard-tier#identify-application-performance-management-apm-agents"/>
<link title="Configure application performance management (APM) integrations" href="http://aka.ms/spring-cloud-to-asa?pivots=sc-standard-tier#configure-application-performance-management-apm-integrations"/>
<link title="Application Insights" href="https://docs.microsoft.com/azure/azure-monitor/app/app-insights-overview"/>
<tag>APM</tag>
</hint>
<technology-tag level="INFORMATIONAL">APM</technology-tag>
</perform>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,16 @@
<![CDATA[
The application uses Eureka.

If a setting like this appears in your application configuration, remove it. Azure Spring Apps will automatically inject the connection information of its configuration server

```
eureka:
client:
serviceUrl:
defaultZone: http://myusername:mysecretpassword@localhost:8761/eureka/
```
Azure Spring Apps will host eureka server for you.
Eureka connection configurations will be injected automatically by ASA, if you put these configurations in your Config Server, please remove them.
]]>
</message>
<link title="Distributed Tracing" href="https://learn.microsoft.com/azure/developer/java/migration/migrate-spring-cloud-to-azure-spring-apps?pivots=sc-standard-tier#remove-explicit-configuration-server-settings"/>
<link title="Azure Spring Apps - Enable Service Registration" href="https://learn.microsoft.com/azure/spring-apps/how-to-service-registration?pivots=programming-language-java"/>
<link title="Azure Spring Apps - Access Config Server and Service Registry" href="https://learn.microsoft.com/azure/spring-apps/how-to-access-data-plane-azure-ad-rbac"/>
<link title="Restricted configurations" href="http://aka.ms/spring-cloud-to-asa?pivots=sc-standard-tier#remove-restricted-configurations"/>
<tag>eureka</tag>
</hint>
<technology-tag level="INFORMATIONAL">Eureka</technology-tag>
</perform>
</rule>
</rules>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<ruleset id="spring-boot-to-azure-version"
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>
Recommend Spring Boot open source support version
</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>version</tag>
</metadata>
<rules>
<rule id="spring-boot-to-azure-version-01000">
<when>
<project>
<artifact groupId="org.springframework.boot" artifactId="{*}" fromVersion="1" toVersion="1.9"/>
</project>
</when>
<perform>
<hint title="Spring Boot version too low" category-id="mandatory" effort="5">
<message>
The application uses Spring Boot 1.x, which is too low.
Update to open source support version of Spring Boot.
</message>
<link title="Spring Boot Support Versions" href="https://github.com/spring-projects/spring-boot/wiki/Supported-Versions"/>
</hint>
</perform>
</rule>
<rule id="spring-boot-to-azure-version-02000">
<when>
<project>
<artifact groupId="org.springframework.boot" artifactId="{*}" fromVersion="2" toVersion="2.4.99"/>
</project>
</when>
<perform>
<hint title="Spring Boot version out of support" category-id="potential" effort="2">
<message>
Spring boot version is out of any spring boot support scope.
Update to open source support version of Spring Boot.
</message>
<link title="Spring Boot Supported Versions" href="https://github.com/spring-projects/spring-boot/wiki/Supported-Versions"/>
</hint>
</perform>
</rule>
<rule id="spring-boot-to-azure-version-03000">
<when>
<project>
<artifact groupId="org.springframework.boot" artifactId="{*}" fromVersion="2.5" toVersion="2.6.99"/>
</project>
</when>
<perform>
<hint title="Spring Boot version out of OSS support" category-id="information" effort="1">
<message>
Spring Boot version is out of open source software support.
Update to open source support version of Spring Boot, if you don't have commercial support.
</message>
<link title="Spring Boot Supported Versions" href="https://github.com/spring-projects/spring-boot/wiki/Supported-Versions"/>
</hint>
</perform>
</rule>
</rules>
</ruleset>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0"?>
<ruleset id="spring-cloud-to-azure-version"
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>
Recommend Spring cloud open source support version
</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>version</tag>
</metadata>
<rules>
<rule id="spring-cloud-to-azure-version-01000">
<when>
<project>
<artifact groupId="org.springframework.cloud" artifactId="spring-cloud-dependencies" fromVersion="Angel" toVersion="Edgware.9"/>
</project>
</when>
<perform>
<hint title="spring cloud version too low" category-id="mandatory" effort="5">
<message>
<![CDATA[
Spring Cloud version too low.
Update to open source support version of Spring Cloud.
]]>
</message>
<link title="Spring Cloud Supported Versions" href="https://github.com/spring-cloud/spring-cloud-release/wiki/Supported-Versions"/>
</hint>
</perform>
</rule>
<rule id="spring-cloud-to-azure-version-02000">
<when>
<project>
<artifact groupId="org.springframework.cloud" artifactId="spring-cloud-dependencies" fromVersion="Finchley" toVersion="Hoxton.9"/>
</project>
</when>
<perform>
<hint title="spring cloud version out of support" category-id="potential" effort="2">
<message>
<![CDATA[
Spring Cloud version is out of any Spring Cloud support scope.
Update to open source support version of Spring Cloud.
]]>
</message>
<link title="Spring Cloud Supported Versions" href="https://github.com/spring-cloud/spring-cloud-release/wiki/Supported-Versions"/>
</hint>
</perform>
</rule>
<rule id="spring-cloud-to-azure-version-03000">
<when>
<or>
<project>
<artifact groupId="org.springframework.cloud" artifactId="spring-cloud-dependencies" fromVersion="Ilford" toVersion="Ilford.9"/>
</project>
<project>
<artifact groupId="org.springframework.cloud" artifactId="spring-cloud-dependencies" fromVersion="2020" toVersion="2020.9"/>
</project>
</or>
</when>
<perform>
<hint title="spring cloud version out of OSS support" category-id="information" effort="1">
<message>
<![CDATA[
Spring Cloud version is out of open source software support.
Update to open source support version of Spring Cloud, if you don't have commercial support.
]]>
</message>
<link title="Spring Cloud Supported Versions" href="https://github.com/spring-cloud/spring-cloud-release/wiki/Supported-Versions"/>
</hint>
</perform>
</rule>
</rules>
</ruleset>
Loading