Check disallowed imports in agent instrumentation classes (#2908)
* Check disallowed imports in agent instrumentation classes * Remove check script * Remove script
This commit is contained in:
parent
09564919cb
commit
48835348bb
|
|
@ -58,14 +58,6 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
stage('Check agent plugin instrumentation imports') {
|
||||
steps {
|
||||
sh './tools/check/agent/plugin/PluginImportedCheck.sh apm-sdk-plugin'
|
||||
sh './tools/check/agent/plugin/PluginImportedCheck.sh apm-toolkit-activation'
|
||||
sh './tools/check/agent/plugin/PluginImportedCheck.sh optional-plugins'
|
||||
}
|
||||
}
|
||||
|
||||
stage('Test & Report') {
|
||||
steps {
|
||||
sh './mvnw -P"agent,backend,ui,dist,CI-with-IT" org.jacoco:jacoco-maven-plugin:0.8.3:prepare-agent clean install org.jacoco:jacoco-maven-plugin:0.8.3:report coveralls:report'
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
||||
"http://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
<!--Refer http://checkstyle.sourceforge.net/reports/google-java-style.html#s2.2-file-encoding -->
|
||||
<module name="Checker">
|
||||
|
||||
|
|
@ -104,5 +104,10 @@
|
|||
<module name="ParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
<module name="TypecastParenPad"/>
|
||||
|
||||
<module name="ImportControl">
|
||||
<property name="file" value="apm-checkstyle/importControl.xml" />
|
||||
<property name="path" value="apm-sniffer/apm-sdk-plugin/.+/src/main/.+Instrumentation.java$" />
|
||||
</module>
|
||||
</module>
|
||||
</module>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
~ Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
~ contributor license agreements. See the NOTICE file distributed with
|
||||
|
|
@ -17,17 +17,12 @@
|
|||
~
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache</groupId>
|
||||
<artifactId>apache</artifactId>
|
||||
<version>19</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<!DOCTYPE import-control PUBLIC
|
||||
"-//Puppy Crawl//DTD Import Control 1.4//EN"
|
||||
"https://checkstyle.org/dtds/import_control_1_4.dtd">
|
||||
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>apm-checkstyle</artifactId>
|
||||
<version>6.1.0</version>
|
||||
<description>Module to hold Checkstyle for SkyWalking.</description>
|
||||
</project>
|
||||
<import-control pkg="org.apache.skywalking.apm.plugin">
|
||||
<allow pkg="java"/>
|
||||
<allow pkg="org.apache.skywalking"/>
|
||||
<allow pkg="net.bytebuddy"/>
|
||||
</import-control>
|
||||
14
pom.xml
14
pom.xml
|
|
@ -35,7 +35,6 @@
|
|||
<modules>
|
||||
<module>apm-commons</module>
|
||||
<module>apm-protocol</module>
|
||||
<module>apm-checkstyle</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
|
|
@ -205,7 +204,7 @@
|
|||
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
|
||||
<versions-maven-plugin.version>2.5</versions-maven-plugin.version>
|
||||
<coveralls-maven-plugin.version>4.3.0</coveralls-maven-plugin.version>
|
||||
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
|
||||
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
|
||||
<jacoco-maven-plugin.version>0.8.3</jacoco-maven-plugin.version>
|
||||
<jmh.version>1.21</jmh.version>
|
||||
<gmaven-plugin.version>1.5</gmaven-plugin.version>
|
||||
|
|
@ -498,16 +497,9 @@
|
|||
<plugin>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${maven-checkstyle-plugin.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.skywalking</groupId>
|
||||
<artifactId>apm-checkstyle</artifactId>
|
||||
<version>6.0.0-GA</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<configLocation>skywalking/checkStyle.xml</configLocation>
|
||||
<headerLocation>skywalking/CHECKSTYLE_HEAD</headerLocation>
|
||||
<configLocation>apm-checkstyle/checkStyle.xml</configLocation>
|
||||
<headerLocation>apm-checkstyle/CHECKSTYLE_HEAD</headerLocation>
|
||||
<encoding>UTF-8</encoding>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<includeTestSourceDirectory>true</includeTestSourceDirectory>
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
plugin_dir=$1
|
||||
for dir in `ls "./apm-sniffer/$plugin_dir/"`; do
|
||||
echo "Scanning $dir"
|
||||
for f in `find ./apm-sniffer/$plugin_dir/$dir -name *Instrumentation.java `; do
|
||||
NUM=`head -400 $f | grep ^import |grep -Ev "^import\s+(static\s+)*net.bytebuddy\\." \
|
||||
| grep -Ev "^import\s+(static\s+)*org.apache.skywalking\\." |grep -Ev "^import\s+(static\s+)*java\\." | wc -l`
|
||||
if [ $NUM -gt 0 ] ; then
|
||||
echo "Plugin: $dir($f), only allow to import JDK and ByteBuddy classes in Instrumentation definition.";
|
||||
exit 1;
|
||||
fi
|
||||
done
|
||||
done
|
||||
Loading…
Reference in New Issue