Fix the build on Linux ARM64 CPU architecture (#7408)

* Issue #7349 - Fix the build on ARM64 CPU architecture

Update embedded-redis and embedded-consul to newer versions which have native binaries for aarch64
Re-introduce TravisCI as a build tool only for ARM64. It will run as a cron job every night

* Issue #7408 - Set the scope of groovy-xml in the dependencyManagement section

Inline the version so that it is not forgotten to be removed when the dependency is removed with the upgrade to embedded-consul:2.2.1

See https://github.com/pszymczyk/embedded-consul/pull/114

* Update embedded-redis to 0.10.0

* DUBBO-7349 Upgrade Embedded-Consul to 2.2.1

* DUBBO-7349 Add scope=test to all occurrences of embedded-[redis|consul]
This commit is contained in:
Martin Grigorov 2021-04-15 11:23:46 +03:00 committed by GitHub
parent a66629459d
commit 062166fa6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 71 additions and 24 deletions

30
.travis.yml Normal file
View File

@ -0,0 +1,30 @@
sudo: false # faster builds
os: linux
dist: focal
arch: arm64-graviton2
virt: lxd
group: edge
language: java
jdk: openjdk11
cache:
directories:
- $HOME/.m2
install: true
branches:
only:
- master
before_script:
- rm -rf $HOME/.m2/repository/org/glassfish/javax.el/3.0.1-b08
script: if [[ "${TRAVIS_EVENT_TYPE}" == "cron" ]]; then travis_wait 60 ./mvnw --batch-mode -U -e --no-transfer-progress clean test -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true; fi
after_success:
- bash <(curl -s https://codecov.io/bash)
after_failure:
- echo "build failed!"

View File

@ -60,6 +60,23 @@ git push origin your_awesome_patch
Thanks for contributing!
### Debugging issues on Linux ARM64
Apache Dubbo officially supports ARM64 CPU architecture!
The project uses TravisCI to run the build and tests every night.
If one needs to debug a problem on ARM64 and has no access to such hardware then the following setup with Docker and QEMU could be used on a
x86_64 machine:
(dev-machine) $ docker run -it --rm --privileged multiarch/qemu-user-static --credential yes --persistent yes
(dev-machine) $ docker run -it --rm -v /path/to/dubbo:/dubbo arm64v8/ubuntu:focal bash
(docker) # apt install ... # jdk, ...
(docker) # cd /dubbo
(docker) # ./mvnw clean test
More information about the Docker+QEMU setup could be found [here](https://martin-grigorov.medium.
com/building-linux-packages-for-different-cpu-architectures-with-docker-and-qemu-d29e4ebc9fa5).
### Code style
We provide a template file [dubbo_codestyle_for_idea.xml](https://github.com/apache/dubbo/tree/master/codestyle/dubbo_codestyle_for_idea.xml) for IntelliJ idea that you can import it to your workplace.

View File

@ -1,6 +1,7 @@
# Apache Dubbo Project
[![Build Status](https://github.com/apache/dubbo/workflows/Build%20and%20Test/badge.svg?branch=master)](https://github.com/apache/dubbo/actions/workflows/build-and-test.yml?query=branch%3Amaster+)
[![Build Status](https://api.travis-ci.com/apache/dubbo.svg?branch=master)](https://travis-ci.com/github/apache/dubbo)
[![Codecov](https://codecov.io/gh/apache/dubbo/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo)
![Maven](https://img.shields.io/maven-central/v/org.apache.dubbo/dubbo.svg)
![License](https://img.shields.io/github/license/alibaba/dubbo.svg)

View File

@ -40,6 +40,7 @@
<dependency>
<groupId>com.pszymczyk.consul</groupId>
<artifactId>embedded-consul</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -103,7 +103,7 @@
<curator_test_version>2.12.0</curator_test_version>
<jedis_version>3.3.0</jedis_version>
<consul_version>1.4.2</consul_version>
<consul_process_version>2.0.0</consul_process_version>
<consul_process_version>2.2.1</consul_process_version>
<consul_client_version>1.3.7</consul_client_version>
<xmemcached_version>1.3.6</xmemcached_version>
<cxf_version>3.1.15</cxf_version>
@ -140,7 +140,7 @@
<log4j2_version>2.11.1</log4j2_version>
<commons_io_version>2.6</commons_io_version>
<embedded_redis_version>0.6</embedded_redis_version>
<embedded_redis_version>0.10.0</embedded_redis_version>
<!-- Eureka -->
<eureka.version>1.9.12</eureka.version>
@ -635,7 +635,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<groupId>com.github.codemonstur</groupId>
<artifactId>embedded-redis</artifactId>
<version>${embedded_redis_version}</version>
<scope>test</scope>

View File

@ -41,7 +41,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<groupId>com.github.codemonstur</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>

View File

@ -35,7 +35,7 @@ import redis.clients.jedis.Jedis;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.embedded.RedisServer;
import redis.embedded.RedisServerBuilder;
import redis.embedded.core.RedisServerBuilder;
import java.io.IOException;
import java.util.HashMap;
@ -60,7 +60,7 @@ public class RedisMetadataReportTest {
String methodName = testInfo.getTestMethod().get().getName();
if ("testAuthRedisMetadata".equals(methodName) || ("testWrongAuthRedisMetadata".equals(methodName))) {
String password = "チェリー";
RedisServerBuilder builder = RedisServer.builder().port(redisPort).setting("requirepass " + password);
RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort).setting("requirepass " + password);
if (SystemUtils.IS_OS_WINDOWS) {
// set maxheap to fix Windows error 0x70 while starting redis
builder.setting("maxheap 128mb");
@ -68,7 +68,7 @@ public class RedisMetadataReportTest {
redisServer = builder.build();
registryUrl = URL.valueOf("redis://username:" + password + "@localhost:" + redisPort);
} else {
RedisServerBuilder builder = RedisServer.builder().port(redisPort);
RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort);
if (SystemUtils.IS_OS_WINDOWS) {
// set maxheap to fix Windows error 0x70 while starting redis
builder.setting("maxheap 128mb");

View File

@ -80,8 +80,6 @@ import static org.apache.dubbo.common.constants.ConsulConstants.INVALID_PORT;
*/
public class ConsulServiceDiscovery extends AbstractServiceDiscovery implements EventListener<ServiceInstancesChangedEvent> {
private static final Logger logger = LoggerFactory.getLogger(ConsulServiceDiscovery.class);
private static final String QUERY_TAG = "consul_query_tag";
private static final String REGISTER_TAG = "consul_register_tag";

View File

@ -53,7 +53,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<groupId>com.github.codemonstur</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>

View File

@ -32,7 +32,7 @@ import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import redis.embedded.RedisServer;
import redis.embedded.RedisServerBuilder;
import redis.embedded.core.RedisServerBuilder;
import java.util.ArrayList;
import java.util.List;
@ -68,7 +68,7 @@ public class MultipleRegistry2S2RTest {
zookeeperRegistryURLStr = "zookeeper://127.0.0.1:" + zkServerPort;
redisServerPort = NetUtils.getAvailablePort();
RedisServerBuilder builder = RedisServer.builder().port(redisServerPort);
RedisServerBuilder builder = RedisServer.newRedisServer().port(redisServerPort);
if (SystemUtils.IS_OS_WINDOWS) {
// set maxheap to fix Windows error 0x70 while starting redis
builder.setting("maxheap 128mb");

View File

@ -45,7 +45,7 @@
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<groupId>com.github.codemonstur</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>
@ -55,4 +55,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>

View File

@ -23,12 +23,11 @@ import org.apache.dubbo.registry.NotifyListener;
import org.apache.dubbo.registry.Registry;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.embedded.RedisServer;
import redis.embedded.RedisServerBuilder;
import redis.embedded.core.RedisServerBuilder;
import java.util.List;
import java.util.Map;
@ -50,7 +49,7 @@ public class RedisRegistryTest {
@BeforeEach
public void setUp() throws Exception {
int redisPort = NetUtils.getAvailablePort();
RedisServerBuilder builder = RedisServer.builder().port(redisPort);
RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort);
if (SystemUtils.IS_OS_WINDOWS) {
// set maxheap to fix Windows error 0x70 while starting redis
builder.setting("maxheap 128mb");

View File

@ -40,7 +40,7 @@
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>com.github.kstyrc</groupId>
<groupId>com.github.codemonstur</groupId>
<artifactId>embedded-redis</artifactId>
<scope>test</scope>
</dependency>
@ -56,4 +56,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>

View File

@ -39,9 +39,10 @@ import redis.clients.jedis.JedisPool;
import redis.clients.jedis.exceptions.JedisConnectionException;
import redis.clients.jedis.exceptions.JedisDataException;
import redis.embedded.RedisServer;
import redis.embedded.RedisServerBuilder;
import redis.embedded.core.RedisServerBuilder;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
@ -54,12 +55,12 @@ public class RedisProtocolTest {
private URL registryUrl;
@BeforeEach
public void setUp(TestInfo testInfo) {
public void setUp(TestInfo testInfo) throws IOException {
int redisPort = NetUtils.getAvailablePort();
String methodName = testInfo.getTestMethod().get().getName();
if ("testAuthRedis".equals(methodName) || ("testWrongAuthRedis".equals(methodName))) {
String password = "123456";
RedisServerBuilder builder = RedisServer.builder().port(redisPort).setting("requirepass " + password);
RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort).setting("requirepass " + password);
if (SystemUtils.IS_OS_WINDOWS) {
// set maxheap to fix Windows error 0x70 while starting redis
builder.setting("maxheap 128mb");
@ -67,7 +68,7 @@ public class RedisProtocolTest {
redisServer = builder.build();
this.registryUrl = URL.valueOf("redis://username:" + password + "@localhost:" + redisPort + "?db.index=0");
} else {
RedisServerBuilder builder = RedisServer.builder().port(redisPort);
RedisServerBuilder builder = RedisServer.newRedisServer().port(redisPort);
if (SystemUtils.IS_OS_WINDOWS) {
// set maxheap to fix Windows error 0x70 while starting redis
builder.setting("maxheap 128mb");
@ -79,7 +80,7 @@ public class RedisProtocolTest {
}
@AfterEach
public void tearDown() {
public void tearDown() throws IOException {
this.redisServer.stop();
}
@Test