You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by xi...@apache.org on 2021/08/23 03:10:59 UTC
[incubator-shenyu] branch master updated: Update ci.yml (#1939)
This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 1456694 Update ci.yml (#1939)
1456694 is described below
commit 14566944313b0cd39d404d1c7b71f5f332a82342
Author: dengliming <li...@gmail.com>
AuthorDate: Mon Aug 23 11:10:55 2021 +0800
Update ci.yml (#1939)
* Update ci.yml
* Upgrade jacoco-maven-plugin version
* fix
* Upgrade spring-boot version
* fix
* fix
* fix
* revert
* fix
* cleanup
* set skip ci
---
.github/workflows/ci.yml | 11 ++++++++
.github/workflows/codeql-analysis.yml | 9 +++++--
pom.xml | 18 ++++++++-----
shenyu-admin/pom.xml | 6 +++++
.../controller/DashboardUserControllerTest.java | 3 ++-
.../configuration/ShenyuNettyWebServerFactory.java | 4 +--
.../org/apache/shenyu/common/utils/GsonUtils.java | 30 ++++++++++++++++++++++
.../shenyu-examples-springcloud/pom.xml | 5 ++++
.../docker-compose.yml | 19 +++++---------
.../script/services.list | 6 ++---
.../SpringCloudIntegratedBootstrap.java | 4 +--
.../src/main/resources/application-local.yml | 12 ++-------
.../plugin/base/fallback/FallbackHandlerTest.java | 2 +-
.../shenyu/plugin/httpclient/WebClientPlugin.java | 4 +--
.../handler/RateLimiterPluginDataHandlerTest.java | 2 +-
shenyu-plugin/shenyu-plugin-springcloud/pom.xml | 2 +-
16 files changed, 92 insertions(+), 45 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3ab66ce..f71499c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -27,6 +27,17 @@ jobs:
matrix:
java: [ 8, 11 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
+ include:
+ - java: 12
+ os: ubuntu-latest
+ - java: 13
+ os: ubuntu-latest
+ - java: 14
+ os: ubuntu-latest
+ - java: 15
+ os: ubuntu-latest
+ - java: 16
+ os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- name: Support longpaths
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 7eed979..ac31879 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -17,7 +17,6 @@ name: "CodeQL"
on:
push:
- branches: [master]
pull_request:
branches: [master]
@@ -36,14 +35,17 @@ jobs:
uses: actions/checkout@v2
with:
submodules: true
-
+ - name: Set Skip Env Var
+ uses: ./.github/actions/skip-ci
- name: Set up JDK 1.8
uses: actions/setup-java@v1
+ if: env.SKIP_CI != 'true'
with:
java-version: 1.8
- name: Cache local Maven repository
uses: actions/cache@v2
+ if: env.SKIP_CI != 'true'
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -52,11 +54,14 @@ jobs:
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
+ if: env.SKIP_CI != 'true'
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v1
+ if: env.SKIP_CI != 'true'
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
+ if: env.SKIP_CI != 'true'
diff --git a/pom.xml b/pom.xml
index 3672c80..a7facea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,14 +52,14 @@
<distribution>repo</distribution>
</license>
</licenses>
-
+
<scm>
<url>https://github.com/apache/incubator-shenyu</url>
<connection>scm:git:https://github.com/apache/incubator-shenyu.git</connection>
<developerConnection>scm:git:https://github.com/apache/incubator-shenyu.git</developerConnection>
<tag>HEAD</tag>
</scm>
-
+
<mailingLists>
<mailingList>
<name>Apache ShenYu Developer List</name>
@@ -68,7 +68,7 @@
<unsubscribe>dev-unsubscribe@shenyu.apache.org</unsubscribe>
</mailingList>
</mailingLists>
-
+
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/apache/incubator-shenyu/issues</url>
@@ -125,7 +125,7 @@
<!--maven plugin version-->
<exec-maven-plugin.version>1.6.0</exec-maven-plugin.version>
<apache-rat-plugin.version>0.13</apache-rat-plugin.version>
- <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
+ <jacoco-maven-plugin.version>0.8.7</jacoco-maven-plugin.version>
<nexus-staging-maven-plugin.version>1.6.3</nexus-staging-maven-plugin.version>
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
@@ -139,6 +139,7 @@
<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version>
<frontend-maven-plugin.node.version>v12.14.1</frontend-maven-plugin.node.version>
<bytebuddy.version>1.10.16</bytebuddy.version>
+ <spring-ldap.version>2.3.4.RELEASE</spring-ldap.version>
</properties>
<dependencyManagement>
@@ -157,7 +158,7 @@
<artifactId>byte-buddy</artifactId>
<version>${bytebuddy.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
@@ -445,8 +446,12 @@
<version>${powermock.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-validation</artifactId>
+ </dependency>
</dependencies>
-
+
<profiles>
<profile>
<id>release</id>
@@ -512,6 +517,7 @@
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<sourcepath>src/main/java</sourcepath>
+ <detectJavaApiLink>false</detectJavaApiLink>
</configuration>
<executions>
<execution>
diff --git a/shenyu-admin/pom.xml b/shenyu-admin/pom.xml
index cf6b992..bad5579 100644
--- a/shenyu-admin/pom.xml
+++ b/shenyu-admin/pom.xml
@@ -174,6 +174,12 @@
</dependency>
<dependency>
+ <groupId>org.springframework.ldap</groupId>
+ <artifactId>spring-ldap-core</artifactId>
+ <version>${spring-ldap.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.101tec</groupId>
<artifactId>zkclient</artifactId>
<exclusions>
diff --git a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
index 5197250..69cfdd1 100644
--- a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
+++ b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/DashboardUserControllerTest.java
@@ -27,6 +27,7 @@ import org.apache.shenyu.admin.model.vo.DashboardUserEditVO;
import org.apache.shenyu.admin.model.vo.DashboardUserVO;
import org.apache.shenyu.admin.model.vo.RoleVO;
import org.apache.shenyu.common.utils.GsonUtils;
+import org.assertj.core.util.Lists;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -158,7 +159,7 @@ public final class DashboardUserControllerTest {
@Test
public void deleteDashboardUser() throws Exception {
final String url = "/dashboardUser/batch";
- final List<String> ids = Collections.emptyList();
+ final List<String> ids = Lists.newArrayList();
given(dashboardUserService.delete(any())).willReturn(0);
mockMvc.perform(delete(url, ids)
.content(GsonUtils.getInstance().toJson(ids))
diff --git a/shenyu-bootstrap/src/main/java/org/apache/shenyu/bootstrap/configuration/ShenyuNettyWebServerFactory.java b/shenyu-bootstrap/src/main/java/org/apache/shenyu/bootstrap/configuration/ShenyuNettyWebServerFactory.java
index 9cf0224..ebab196 100644
--- a/shenyu-bootstrap/src/main/java/org/apache/shenyu/bootstrap/configuration/ShenyuNettyWebServerFactory.java
+++ b/shenyu-bootstrap/src/main/java/org/apache/shenyu/bootstrap/configuration/ShenyuNettyWebServerFactory.java
@@ -44,7 +44,7 @@ public class ShenyuNettyWebServerFactory {
webServerFactory.addServerCustomizers(new EventLoopNettyCustomizer(nettyTcpConfig));
return webServerFactory;
}
-
+
/**
* Netty tcp config.
*
@@ -77,6 +77,6 @@ public class ShenyuNettyWebServerFactory {
.option(ChannelOption.SO_REUSEADDR, nettyTcpConfig.isSoReuseaddr())
.option(ChannelOption.SO_LINGER, nettyTcpConfig.getSoLinger())
.option(ChannelOption.TCP_NODELAY, nettyTcpConfig.isTcpNodelay()));
- }
+ }
}
}
diff --git a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java
index 006d8a4..e71c291 100644
--- a/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java
+++ b/shenyu-common/src/main/java/org/apache/shenyu/common/utils/GsonUtils.java
@@ -45,6 +45,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URLDecoder;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@@ -68,6 +69,7 @@ public class GsonUtils {
private static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(String.class, new StringTypeAdapter())
.registerTypeHierarchyAdapter(Pair.class, new PairTypeAdapter())
+ .registerTypeHierarchyAdapter(Duration.class, new DurationTypeAdapter())
.create();
private static final Gson GSON_MAP = new GsonBuilder().serializeNulls().registerTypeHierarchyAdapter(new TypeToken<Map<String, Object>>() {
@@ -456,4 +458,32 @@ public class GsonUtils {
return Pair.of(left, right);
}
}
+
+ private static class DurationTypeAdapter extends TypeAdapter<Duration> {
+ @Override
+ public void write(final JsonWriter out, final Duration value) {
+ try {
+ if (value == null) {
+ out.nullValue();
+ return;
+ }
+ out.value(value.toString());
+ } catch (IOException e) {
+ LOG.error("failed to write", e);
+ }
+ }
+
+ @Override
+ public Duration read(final JsonReader reader) {
+ try {
+ if (reader.peek() == JsonToken.NULL) {
+ reader.nextNull();
+ return null;
+ }
+ return Duration.parse(reader.nextString());
+ } catch (IOException e) {
+ throw new ShenyuException(e);
+ }
+ }
+ }
}
diff --git a/shenyu-examples/shenyu-examples-springcloud/pom.xml b/shenyu-examples/shenyu-examples-springcloud/pom.xml
index 77a2c93..74b17d9 100644
--- a/shenyu-examples/shenyu-examples-springcloud/pom.xml
+++ b/shenyu-examples/shenyu-examples-springcloud/pom.xml
@@ -48,6 +48,11 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+
<!-- <dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
diff --git a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
index df5c626..012c71e 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
+++ b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/docker-compose.yml
@@ -31,7 +31,7 @@ services:
- SPRING_PROFILES_ACTIVE=h2
- shenyu.database.init_script=META-INF/schema.h2.sql;file:/opt/sql/schema.sql
healthcheck:
- test: [ "CMD", "wget", "-q", "-O", "-", "http://localhost:9095/actuator/health" ]
+ test: ["CMD-SHELL", "wget -q -O - http://shenyu-admin:9095/actuator/health | grep UP || exit 1"]
timeout: 2s
retries: 3
start_period: 5s
@@ -44,7 +44,7 @@ services:
image: shenyu-examples-eureka:latest
restart: always
healthcheck:
- test: [ "CMD", "wget", "-q", "-O", "-", "http://localhost:8761" ]
+ test: ["CMD-SHELL", "wget -q -O - http://localhost:8761/actuator/health | grep UP || exit 1"]
timeout: 2s
retries: 3
start_period: 5s
@@ -67,7 +67,7 @@ services:
- shenyu.client.serverLists=http://shenyu-admin:9095
- eureka.client.serviceUrl.defaultZone=http://shenyu-examples-eureka:8761/eureka/
healthcheck:
- test: [ "CMD", "wget", "-q", "-O", "-", "http://localhost:8884/test/findByUserId?userId=tom" ]
+ test: ["CMD-SHELL", "wget -q -O - http://localhost:8884/actuator/health | grep UP || exit 1"]
timeout: 2s
retries: 3
start_period: 5s
@@ -76,7 +76,7 @@ services:
networks:
- shenyu
depends_on:
- shenyu-examples-eureka:
+ shenyu-integrated-test-spring-cloud:
condition: service_healthy
# from http plugin dockerfile
shenyu-integrated-test-spring-cloud:
@@ -91,24 +91,17 @@ services:
- shenyu.sync.websocket.urls=ws://shenyu-admin:9095/websocket
- eureka.client.serviceUrl.defaultZone=http://shenyu-examples-eureka:8761/eureka/
depends_on:
- - shenyu-examples-springcloud
+ - shenyu-examples-eureka
- shenyu-admin
ports:
- 9195:9195
healthcheck:
- test: [ "CMD", "wget", "-q", "-O", "-", "http://localhost:9195/springcloud/test/findByUserId?userId=Tom" ]
+ test: [ "CMD", "wget", "-q", "-O", "-", "http://shenyu-integrated-test-spring-cloud:9195/actuator/health" ]
timeout: 2s
retries: 3
start_period: 5s
networks:
- shenyu
- health-checker:
- container_name: health-checker
- image: hello-world
- restart: always
- depends_on:
- shenyu-integrated-test-spring-cloud:
- condition: service_healthy
networks:
shenyu:
diff --git a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/script/services.list b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/script/services.list
index ca07692..5610d72 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/script/services.list
+++ b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/script/services.list
@@ -15,6 +15,6 @@
# limitations under the License.
http://localhost:9095/actuator/health
-http://localhost:8761
-http://localhost:8884/test/findByUserId?userId=tom
-http://localhost:9195/springcloud/test/findByUserId?userId=Tom
+http://localhost:8761/actuator/health
+http://localhost:8884/actuator/health
+http://localhost:9195/actuator/health
diff --git a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/java/org/apache/shenyu/integratedtest/springcloud/SpringCloudIntegratedBootstrap.java b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/java/org/apache/shenyu/integratedtest/springcloud/SpringCloudIntegratedBootstrap.java
index 00794ab..68bc07b 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/java/org/apache/shenyu/integratedtest/springcloud/SpringCloudIntegratedBootstrap.java
+++ b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/java/org/apache/shenyu/integratedtest/springcloud/SpringCloudIntegratedBootstrap.java
@@ -19,15 +19,13 @@ package org.apache.shenyu.integratedtest.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* The type Spring cloud integrated bootstrap.
*/
@SpringBootApplication
-@EnableDiscoveryClient
public class SpringCloudIntegratedBootstrap {
-
+
/**
* main method of App.
*
diff --git a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/resources/application-local.yml b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/resources/application-local.yml
index d75206c..1a5a2f9 100644
--- a/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/resources/application-local.yml
+++ b/shenyu-integrated-test/shenyu-integrated-test-spring-cloud/src/main/resources/application-local.yml
@@ -48,19 +48,11 @@ shenyu:
# connectionTimeout: 2000
# http:
# url : http://localhost:9095
-
exclude:
- enabled: false
+ enabled: true
paths:
- /favicon.ico
-
-eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- instance:
- prefer-ip-address: true
-
+ - /actuator/health
logging:
level:
diff --git a/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/fallback/FallbackHandlerTest.java b/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/fallback/FallbackHandlerTest.java
index e88aeb6..4bec8eb 100644
--- a/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/fallback/FallbackHandlerTest.java
+++ b/shenyu-plugin/shenyu-plugin-base/src/test/java/org/apache/shenyu/plugin/base/fallback/FallbackHandlerTest.java
@@ -75,7 +75,7 @@ public final class FallbackHandlerTest {
@Test
public void fallbackTest() {
StepVerifier.create(testFallbackHandler.fallback(exchange, null, mock(RuntimeException.class))).expectSubscription().verifyComplete();
- StepVerifier.create(testFallbackHandler.fallback(exchange, URI.create("http://wwww.baidu.com"), mock(RuntimeException.class))).expectSubscription().verifyComplete();
+ StepVerifier.create(testFallbackHandler.fallback(exchange, URI.create("http://127.0.0.1:8090/SHENYU"), mock(RuntimeException.class))).expectSubscription().verifyComplete();
}
static class TestFallbackHandler implements FallbackHandler {
diff --git a/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/WebClientPlugin.java b/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/WebClientPlugin.java
index ebfc649..3630742 100644
--- a/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/WebClientPlugin.java
+++ b/shenyu-plugin/shenyu-plugin-httpclient/src/main/java/org/apache/shenyu/plugin/httpclient/WebClientPlugin.java
@@ -112,8 +112,8 @@ public class WebClientPlugin implements ShenyuPlugin {
.doOnError(e -> LOG.error(e.getMessage(), e))
.timeout(Duration.ofMillis(timeout))
.retryWhen(Retry.onlyIf(x -> x.exception() instanceof ConnectTimeoutException)
- .retryMax(retryTimes)
- .backoff(Backoff.exponential(Duration.ofMillis(200), Duration.ofSeconds(20), 2, true)))
+ .retryMax(retryTimes)
+ .backoff(Backoff.exponential(Duration.ofMillis(200), Duration.ofSeconds(20), 2, true)))
.flatMap(e -> doNext(e, exchange, chain));
}
diff --git a/shenyu-plugin/shenyu-plugin-ratelimiter/src/test/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandlerTest.java b/shenyu-plugin/shenyu-plugin-ratelimiter/src/test/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandlerTest.java
index 5a747ae..2695dbc 100644
--- a/shenyu-plugin/shenyu-plugin-ratelimiter/src/test/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandlerTest.java
+++ b/shenyu-plugin/shenyu-plugin-ratelimiter/src/test/java/org/apache/shenyu/plugin/ratelimiter/handler/RateLimiterPluginDataHandlerTest.java
@@ -81,7 +81,7 @@ public final class RateLimiterPluginDataHandlerTest {
pluginData.setEnabled(true);
pluginData.setConfig(GsonUtils.getInstance().toJson(rateLimiterConfig));
rateLimiterPluginDataHandler.handlerPlugin(pluginData);
- Assert.assertEquals(rateLimiterConfig, Singleton.INST.get(RateLimiterConfig.class));
+ Assert.assertEquals(rateLimiterConfig.getUrl(), Singleton.INST.get(RateLimiterConfig.class).getUrl());
Assert.assertNotNull(Singleton.INST.get(ReactiveRedisTemplate.class));
}
diff --git a/shenyu-plugin/shenyu-plugin-springcloud/pom.xml b/shenyu-plugin/shenyu-plugin-springcloud/pom.xml
index 7d24330..08e53ea 100644
--- a/shenyu-plugin/shenyu-plugin-springcloud/pom.xml
+++ b/shenyu-plugin/shenyu-plugin-springcloud/pom.xml
@@ -58,4 +58,4 @@
<scope>test</scope>
</dependency>
</dependencies>
-</project>
\ No newline at end of file
+</project>