You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/06/13 09:06:26 UTC
[skywalking] branch master updated: Integrate Jenkins CI (#2864)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new f5db90b Integrate Jenkins CI (#2864)
f5db90b is described below
commit f5db90b8bd98f1ca090844b5e0a915bd974815ed
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Thu Jun 13 17:06:21 2019 +0800
Integrate Jenkins CI (#2864)
* Test
* Sync
* Update ITNacosConfigurationTest.java
* Trigger CI
* Trigger CI
* Trigger CI
* Trigger CI
* Trigger CI
* Remove unused imports to fix checkstyle
* Remove unused imports to fix checkstyle
* Increase timeout since nacos starts slowlly
* Bump up Oracle JDK version
* Remove OracleJDK due to license
* Add CI-with-IT profile and openjdk9
* Add missing profiles
* Lift failsafe plugin to root
* Update pom.xml
* Remove OPENJDK9
* Try parallel builds and add agent
* Try parallel build and windows
* Try parallel build and windows
* Try parallel build and windows
* Try parallel build
* Try parallel build
* Try parallel build
* Fix indentation
* Trigger CI
* Trigger CI
* Remove Windows stage
* Update mvnw.cmd
---
.travis.yml | 4 +-
Jenkinsfile | 84 ++++++------
oap-server/pom.xml | 12 --
.../configuration-nacos/pom.xml | 143 +++++++++++++++++++++
.../nacos/NacosConfigurationProvider.java | 5 +
.../nacos/ITNacosConfigurationTest.java | 19 ++-
.../src/test/resources/application.yml | 4 +-
oap-server/server-library/library-client/pom.xml | 143 ++++++++++++++-------
.../elasticsearch/ITElasticSearchClient.java | 22 +++-
pom.xml | 25 +++-
10 files changed, 345 insertions(+), 116 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index a49a049..09d93a8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,11 +4,9 @@ os:
- linux
jdk:
- - oraclejdk8
- openjdk8
language: java
install:
- - ./mvnw org.jacoco:jacoco-maven-plugin:0.8.3:prepare-agent clean install org.jacoco:jacoco-maven-plugin:0.8.3:report coveralls:report --quiet
- - ./mvnw javadoc:javadoc -Dmaven.test.skip=true --quiet
+ - ./mvnw -DskipTests clean install --quiet
diff --git a/Jenkinsfile b/Jenkinsfile
index 255dfb9..6eaad7b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -17,57 +17,63 @@
*/
pipeline {
- agent {
- label 'ubuntu'
- }
-
- tools {
- jdk 'JDK 1.8 (latest)'
- }
+ agent none
options {
buildDiscarder(logRotator(
- numToKeepStr: '30',
+ numToKeepStr: '60',
))
timestamps()
skipStagesAfterUnstable()
- timeout time: 30, unit: 'MINUTES'
+ timeout time: 60, unit: 'MINUTES'
}
stages {
- stage('SCM Checkout') {
- steps {
- deleteDir()
- checkout scm
- }
- }
+ stage('Install & Test') {
+ parallel {
+ stage('JDK 1.8 on Linux') {
+ agent {
+ label 'xenial'
+ }
- stage('Check environment') {
- steps {
- sh 'env'
- sh 'pwd'
- sh 'ls'
- sh 'git status'
- }
- }
+ tools {
+ jdk 'JDK 1.8 (latest)'
+ }
- stage('Run install') {
- steps {
- sh './mvnw org.jacoco:jacoco-maven-plugin:0.8.3:prepare-agent clean install org.jacoco:jacoco-maven-plugin:0.8.3:report coveralls:report --quiet --batch-mode -nsu'
- }
- }
+ stages {
+ stage('SCM Checkout') {
+ steps {
+ deleteDir()
+ checkout scm
+ sh 'git submodule update --init'
+ }
+ }
- stage('Run install') {
- steps {
- sh './mvnw javadoc:javadoc -Dmaven.test.skip=true --quiet'
- }
- }
- }
+ stage('Check environment') {
+ steps {
+ sh 'env'
+ sh 'pwd'
+ sh 'ls'
+ sh 'git status'
+ }
+ }
+
+ 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'
+ sh './mvnw javadoc:javadoc -Dmaven.test.skip=true'
+ }
+ }
+ }
- post {
- always {
- junit '**/target/surefire-reports/*.xml'
- deleteDir()
+ post {
+ always {
+ junit '**/target/surefire-reports/*.xml'
+ deleteDir()
+ }
+ }
+ }
+ }
}
}
-}
\ No newline at end of file
+}
diff --git a/oap-server/pom.xml b/oap-server/pom.xml
index 6a1ea52..104ae92 100644
--- a/oap-server/pom.xml
+++ b/oap-server/pom.xml
@@ -388,18 +388,6 @@
</excludes>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
</project>
diff --git a/oap-server/server-configuration/configuration-nacos/pom.xml b/oap-server/server-configuration/configuration-nacos/pom.xml
index 207ed8f..67d1943 100644
--- a/oap-server/server-configuration/configuration-nacos/pom.xml
+++ b/oap-server/server-configuration/configuration-nacos/pom.xml
@@ -45,4 +45,147 @@
<artifactId>nacos-client</artifactId>
</dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <id>CI-with-IT</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <configuration>
+ <sourceMode>all</sourceMode>
+ <showLogs>true</showLogs>
+ <logDate>default</logDate>
+ <verbose>true</verbose>
+ <imagePullPolicy>IfNotPresent</imagePullPolicy>
+ <autoCreateCustomNetworks>true</autoCreateCustomNetworks>
+ <images>
+ <image>
+ <name>mysql:5.7</name>
+ <alias>nacos-dynamic-configuration-integration-test-mysql</alias>
+ <run>
+ <network>
+ <name>test-network</name>
+ <alias>mysql</alias>
+ </network>
+ <env>
+ <MYSQL_MASTER_SERVICE_HOST>127.0.0.1</MYSQL_MASTER_SERVICE_HOST>
+ <MYSQL_ALLOW_EMPTY_PASSWORD>yes</MYSQL_ALLOW_EMPTY_PASSWORD>
+ </env>
+ <namingStrategy>none</namingStrategy>
+ <ports>
+ <port>mysql.port:3306</port>
+ </ports>
+ <volumes>
+ <bind>
+ <volume>
+ src/test/resources/docker/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
+ </volume>
+ </bind>
+ </volumes>
+ <wait>
+ <log>ready for connections</log>
+ <time>60000</time>
+ </wait>
+ </run>
+ </image>
+ <image>
+ <name>nacos/nacos-server:${nacos.version}</name>
+ <alias>nacos-dynamic-configuration-integration-test-nacos</alias>
+ <run>
+ <network>
+ <name>test-network</name>
+ <alias>nacos</alias>
+ </network>
+ <env>
+ <MODE>standalone</MODE>
+ <MYSQL_MASTER_SERVICE_HOST>mysql</MYSQL_MASTER_SERVICE_HOST>
+ <MYSQL_MASTER_SERVICE_DB_NAME>test</MYSQL_MASTER_SERVICE_DB_NAME>
+ <MYSQL_MASTER_SERVICE_PORT>${mysql.port}</MYSQL_MASTER_SERVICE_PORT>
+ </env>
+ <namingStrategy>none</namingStrategy>
+ <dependsOn>
+ <container>nacos-dynamic-configuration-integration-test-mysql</container>
+ </dependsOn>
+ <links>
+ <link>nacos-dynamic-configuration-integration-test-mysql</link>
+ </links>
+ <ports>
+ <port>nacos.port:8848</port>
+ </ports>
+ <wait>
+ <log>Nacos started successfully</log>
+ <time>120000</time>
+ </wait>
+ </run>
+ </image>
+ </images>
+ </configuration>
+ <executions>
+ <execution>
+ <id>start</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>${gmaven-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>add-default-properties</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <providerSelection>2.0</providerSelection>
+ <source>
+ project.properties.setProperty('docker.hostname', 'localhost')
+
+ log.info("Docker hostname is " + project.properties['docker.hostname'])
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <nacos.host>
+ ${docker.hostname}
+ </nacos.host>
+ <nacos.port>
+ ${nacos.port}
+ </nacos.port>
+ </systemPropertyVariables>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java b/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java
index 74ecb4d..bcc353b 100644
--- a/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java
+++ b/oap-server/server-configuration/configuration-nacos/src/main/java/org/apache/skywalking/oap/server/configuration/nacos/NacosConfigurationProvider.java
@@ -24,6 +24,8 @@ import org.apache.skywalking.oap.server.configuration.api.AbstractConfigurationP
import org.apache.skywalking.oap.server.configuration.api.ConfigWatcherRegister;
import org.apache.skywalking.oap.server.library.module.ModuleConfig;
import org.apache.skywalking.oap.server.library.module.ModuleStartException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Get configuration from Nacos.
@@ -31,6 +33,8 @@ import org.apache.skywalking.oap.server.library.module.ModuleStartException;
* @author kezhenxu94
*/
public class NacosConfigurationProvider extends AbstractConfigurationProvider {
+ private static final Logger LOGGER = LoggerFactory.getLogger(NacosConfigurationProvider.class);
+
private NacosServerSettings settings;
public NacosConfigurationProvider() {
@@ -49,6 +53,7 @@ public class NacosConfigurationProvider extends AbstractConfigurationProvider {
@Override
protected ConfigWatcherRegister initConfigReader() throws ModuleStartException {
+ LOGGER.info("settings: {}", settings);
if (Strings.isNullOrEmpty(settings.getServerAddr())) {
throw new ModuleStartException("Nacos serverAddr cannot be null or empty.");
}
diff --git a/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java b/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java
index cab8991..1e9d1a0 100644
--- a/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java
+++ b/oap-server/server-configuration/configuration-nacos/src/test/java/org/apache/skywalking/oap/server/configuration/nacos/ITNacosConfigurationTest.java
@@ -27,8 +27,9 @@ import org.apache.skywalking.oap.server.library.module.ModuleManager;
import org.apache.skywalking.oap.server.library.util.CollectionUtils;
import org.apache.skywalking.oap.server.library.util.ResourceUtils;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.yaml.snakeyaml.Yaml;
import java.io.FileNotFoundException;
@@ -36,12 +37,17 @@ import java.io.Reader;
import java.util.Map;
import java.util.Properties;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
/**
* @author kezhenxu94
*/
public class ITNacosConfigurationTest {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ITNacosConfigurationTest.class);
+
private final Yaml yaml = new Yaml();
private NacosConfigurationTestProvider provider;
@@ -63,13 +69,16 @@ public class ITNacosConfigurationTest {
}
@SuppressWarnings("StatementWithEmptyBody")
- @Ignore // because of instability
- @Test(timeout = 10000)
+ @Test(timeout = 20000)
public void shouldReadUpdated() throws NacosException {
assertNull(provider.watcher.value());
final Properties properties = new Properties();
- properties.put("serverAddr", "localhost:8848");
+ final String nacosHost = System.getProperty("nacos.host");
+ final String nacosPort = System.getProperty("nacos.port");
+ LOGGER.info("nacosHost: {}, nacosPort: {}", nacosHost, nacosPort);
+ properties.put("serverAddr", nacosHost + ":" + nacosPort);
+
final ConfigService configService = NacosFactory.createConfigService(properties);
assertTrue(configService.publishConfig("test-module.default.testKey", "skywalking", "500"));
diff --git a/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml b/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml
index fd6a070..fb9624d 100644
--- a/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml
+++ b/oap-server/server-configuration/configuration-nacos/src/test/resources/application.yml
@@ -22,9 +22,9 @@ test-module:
configuration:
nacos:
# Nacos Server Host
- serverAddr: localhost
+ serverAddr: ${nacos.host}
# Nacos Server Port
- port: 8848
+ port: ${nacos.port}
# Nacos Configuration Group
group: 'skywalking'
# Unit seconds, sync period. Default fetch every 60 seconds.
diff --git a/oap-server/server-library/library-client/pom.xml b/oap-server/server-library/library-client/pom.xml
index ed426d8..c5b0e26 100644
--- a/oap-server/server-library/library-client/pom.xml
+++ b/oap-server/server-library/library-client/pom.xml
@@ -17,7 +17,9 @@
~
-->
-<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">
+<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>
<artifactId>server-library</artifactId>
<groupId>org.apache.skywalking</groupId>
@@ -55,51 +57,98 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <configuration>
- <sourceMode>all</sourceMode>
- <logDate>default</logDate>
- <verbose>true</verbose>
- <imagePullPolicy>IfNotPresent</imagePullPolicy>
- </configuration>
- <executions>
- <execution>
- <id>prepare-elasticsearch</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
+ <profiles>
+ <profile>
+ <id>CI-with-IT</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
<configuration>
- <images>
- <image>
- <name>elastic/elasticsearch:${elasticsearch.version}</name>
- <alias>elastic-client-integration-test</alias>
- <run>
- <ports>
- <port>9200:9200</port>
- </ports>
- <wait>
- <log>started</log>
- <time>30000</time>
- </wait>
- </run>
- </image>
- </images>
+ <sourceMode>all</sourceMode>
+ <logDate>default</logDate>
+ <verbose>true</verbose>
+ <imagePullPolicy>IfNotPresent</imagePullPolicy>
</configuration>
- </execution>
- <execution>
- <id>remove-it-database</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
+ <executions>
+ <execution>
+ <id>prepare-elasticsearch</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <images>
+ <image>
+ <name>elastic/elasticsearch:${elasticsearch.version}</name>
+ <alias>elastic-client-integration-test</alias>
+ <run>
+ <ports>
+ <port>es-port:9200</port>
+ </ports>
+ <wait>
+ <log>started</log>
+ <time>30000</time>
+ </wait>
+ <env>
+ <discovery.type>single-node</discovery.type>
+ </env>
+ </run>
+ </image>
+ </images>
+ </configuration>
+ </execution>
+ <execution>
+ <id>remove-it-database</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>${gmaven-plugin.version}</version>
+ <executions>
+ <execution>
+ <id>add-default-properties</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <providerSelection>2.0</providerSelection>
+ <source>
+ project.properties.setProperty('docker.hostname', 'localhost')
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <elastic.search.address>
+ ${docker.hostname}:${es-port}
+ </elastic.search.address>
+ </systemPropertyVariables>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java b/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java
index 3ba3b03..f2f6d28 100644
--- a/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java
+++ b/oap-server/server-library/library-client/src/test/java/org/apache/skywalking/oap/server/library/client/elasticsearch/ITElasticSearchClient.java
@@ -19,18 +19,25 @@
package org.apache.skywalking.oap.server.library.client.elasticsearch;
import com.google.gson.JsonObject;
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
import org.elasticsearch.action.bulk.BulkProcessor;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.common.xcontent.*;
+import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
-import org.junit.*;
-import org.slf4j.*;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
/**
* @author peng-yongsheng
@@ -43,7 +50,8 @@ public class ITElasticSearchClient {
@Before
public void before() throws IOException {
- client = new ElasticSearchClient("localhost:9200", "", "test", "test");
+ final String esAddress = System.getProperty("elastic.search.address");
+ client = new ElasticSearchClient(esAddress, "", "test", "test");
client.connect();
}
diff --git a/pom.xml b/pom.xml
index a4dce43..a6dc5a3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -155,6 +155,28 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>CI-with-IT</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
<properties>
@@ -186,6 +208,7 @@
<maven-checkstyle-plugin.version>3.0.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>
</properties>
<dependencies>
@@ -306,7 +329,7 @@
<rules>
<requireJavaVersion>
<!-- Build has not yet been updated for Java 9+ -->
- <version>[1.8,9)</version>
+ <version>1.8</version>
</requireJavaVersion>
</rules>
</configuration>