This is an automated email from the ASF dual-hosted git repository.
drazzib pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gora.git
The following commit(s) were added to refs/heads/master by this push:
new c361db5 GORA-668 Add Jenkinsfile (#229)
c361db5 is described below
commit c361db5f750bb8227e419c2106709468f677c79e
Author: Damien Raude-Morvan <[email protected]>
AuthorDate: Thu Oct 29 10:01:13 2020 +0100
GORA-668 Add Jenkinsfile (#229)
* GORA-668 Add Jenkinsfile
* GORA-668 Always capture surefire-reports
* GORA-668 Use IP address that test container may be reached on
* GORA-668 Use warnError to avoid failure of build
* GORA-668 Override properties (reads from gora.properties) using test
container configuration (defined in #setUpClass)
---
Jenkinsfile | 94 ++++++++++++++++++++++
.../gora/aerospike/GoraAerospikeTestDriver.java | 2 +-
.../mapreduce/TestAerospikeStoreCountQuery.java | 2 +-
.../TestAerospikeStoreMapReduceSerialization.java | 2 +-
.../mapreduce/TestAerospikeStoreWordCount.java | 2 +-
.../apache/gora/rethinkdb/RethinkDBTestDriver.java | 13 ++-
6 files changed, 108 insertions(+), 7 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..b3eebee
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,94 @@
+#!groovy
+
+/*
+ * 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.
+ */
+
+def AGENT_LABEL = env.AGENT_LABEL ?: 'ubuntu'
+def JDK_NAME = env.JDK_NAME ?: 'jdk_1.8_latest'
+def MVN_NAME = env.MVN_NAME ?: 'maven_3_latest'
+
+// =================================================================
+// https://cwiki.apache.org/confluence/display/INFRA/Jenkins
+//
https://cwiki.apache.org/confluence/display/INFRA/Multibranch+Pipeline+recipes
+// =================================================================
+
+// general pipeline documentation: https://jenkins.io/doc/book/pipeline/syntax/
+pipeline {
+
+ // https://jenkins.io/doc/book/pipeline/syntax/#agent
+ agent {
+ node {
+ label AGENT_LABEL
+ }
+ }
+
+ tools {
+ maven MVN_NAME
+ jdk JDK_NAME
+ }
+
+ // https://jenkins.io/doc/book/pipeline/syntax/#options
+ options {
+ // support ANSI colors in stdout/stderr
+ ansiColor 'xterm'
+ // only keep the latest 10 builds
+ buildDiscarder logRotator(numToKeepStr: '10')
+ // cancel build if not complete within two hours of scheduling
+ timeout time: 2, unit: 'HOURS'
+ disableConcurrentBuilds()
+ }
+
+ environment {
+ LANG = 'C.UTF-8'
+ // --batch-mode Run in non-interactive (batch) mode
+ // --error Produce execution error messages
+ // --fail-at-end Only fail the build afterwards; allow all
non-impacted builds to continue
+ // --show-version Display version information WITHOUT stopping build
+ // --no-transfer-progress Do not display transfer progress when
downloading or uploading
+ MAVEN_CLI_OPTS = "--batch-mode --errors --fail-at-end --show-version
--no-transfer-progress"
+ }
+
+ stages {
+ stage('Build') {
+ steps {
+ sh "mvn $MAVEN_CLI_OPTS -DskipTests clean install"
+ }
+
+ post {
+ success {
+ archiveArtifacts '**/target/*.jar'
+ }
+ }
+ }
+
+ stage('Test') {
+ steps {
+ warnError(message: "Failure during tests execution") {
+ sh "mvn $MAVEN_CLI_OPTS verify"
+ }
+ }
+
+ post {
+ always {
+ junit '**/target/surefire-reports/TEST-*.xml'
+ }
+ }
+ }
+ }
+}
diff --git
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/GoraAerospikeTestDriver.java
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/GoraAerospikeTestDriver.java
index cc11347..9c8a369 100644
---
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/GoraAerospikeTestDriver.java
+++
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/GoraAerospikeTestDriver.java
@@ -45,7 +45,7 @@ public class GoraAerospikeTestDriver extends GoraTestDriver {
@Override
public void setUpClass() throws Exception {
log.info("Setting up Aerospike test driver");
- conf.set("gora.aerospikestore.server.ip", "localhost");
+ conf.set("gora.aerospikestore.server.ip",
aerospikeContainer.getContainerIpAddress());
conf.set("gora.aerospikestore.server.port",
aerospikeContainer.getMappedPort(3000).toString());
}
diff --git
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreCountQuery.java
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreCountQuery.java
index f710f07..72a2ba5 100644
---
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreCountQuery.java
+++
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreCountQuery.java
@@ -49,7 +49,7 @@ public class TestAerospikeStoreCountQuery {
@Before
public void setUp() throws Exception {
- conf.set("gora.aerospikestore.server.ip", "localhost");
+ conf.set("gora.aerospikestore.server.ip",
aerospikeContainer.getContainerIpAddress());
conf.set("gora.aerospikestore.server.port",
aerospikeContainer.getMappedPort(3000).toString());
webPageStore = DataStoreFactory
diff --git
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreMapReduceSerialization.java
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreMapReduceSerialization.java
index a2cc51c..b8f281e 100644
---
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreMapReduceSerialization.java
+++
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreMapReduceSerialization.java
@@ -50,7 +50,7 @@ public class TestAerospikeStoreMapReduceSerialization {
@Before
public void setUp() throws Exception {
- conf.set("gora.aerospikestore.server.ip", "localhost");
+ conf.set("gora.aerospikestore.server.ip",
aerospikeContainer.getContainerIpAddress());
conf.set("gora.aerospikestore.server.port",
aerospikeContainer.getMappedPort(3000).toString());
webPageStore = DataStoreFactory
diff --git
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreWordCount.java
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreWordCount.java
index 8d9d7e9..5e31f56 100644
---
a/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreWordCount.java
+++
b/gora-aerospike/src/test/java/org/apache/gora/aerospike/mapreduce/TestAerospikeStoreWordCount.java
@@ -52,7 +52,7 @@ public class TestAerospikeStoreWordCount {
@Before
public void setUp() throws Exception {
- conf.set("gora.aerospikestore.server.ip", "localhost");
+ conf.set("gora.aerospikestore.server.ip",
aerospikeContainer.getContainerIpAddress());
conf.set("gora.aerospikestore.server.port",
aerospikeContainer.getMappedPort(3000).toString());
webPageStore = DataStoreFactory
diff --git
a/gora-rethinkdb/src/test/java/org/apache/gora/rethinkdb/RethinkDBTestDriver.java
b/gora-rethinkdb/src/test/java/org/apache/gora/rethinkdb/RethinkDBTestDriver.java
index 2f8d0c7..3df6758 100644
---
a/gora-rethinkdb/src/test/java/org/apache/gora/rethinkdb/RethinkDBTestDriver.java
+++
b/gora-rethinkdb/src/test/java/org/apache/gora/rethinkdb/RethinkDBTestDriver.java
@@ -29,6 +29,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
+import java.util.Properties;
+
/**
* Driver to set up an embedded RethinkDB database instance for Gora
* dataStore specific integration tests.
@@ -56,7 +58,7 @@ public class RethinkDBTestDriver extends GoraTestDriver {
@Override
public void setUpClass() throws Exception {
log.info("Setting up RethinkDB test driver");
- conf.set(RethinkDBStoreParameters.RETHINK_DB_SERVER_HOST, "localhost");
+ conf.set(RethinkDBStoreParameters.RETHINK_DB_SERVER_HOST,
rethinkdbContainer.getContainerIpAddress());
conf.set(RethinkDBStoreParameters.RETHINK_DB_SERVER_PORT,
rethinkdbContainer.getMappedPort(28015).toString());
log.info("RethinkDB Embedded Server started successfully.");
@@ -73,10 +75,15 @@ public class RethinkDBTestDriver extends GoraTestDriver {
@Override
public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K>
keyClass,
Class<T>
persistentClass) throws GoraException {
-
+ // Override properties (reads from gora.properties) using test container
configuration (defined in #setUpClass)
+ Properties props = DataStoreFactory.createProps();
+ props.setProperty(RethinkDBStoreParameters.RETHINK_DB_SERVER_HOST,
+ conf.get(RethinkDBStoreParameters.RETHINK_DB_SERVER_HOST));
+ props.setProperty(RethinkDBStoreParameters.RETHINK_DB_SERVER_PORT,
+ conf.get(RethinkDBStoreParameters.RETHINK_DB_SERVER_PORT));
final DataStore<K, T> dataStore = DataStoreFactory
.createDataStore((Class<? extends DataStore<K, T>>)
dataStoreClass, keyClass,
- persistentClass, conf);
+ persistentClass, conf, props);
dataStores.add(dataStore);
log.info("Datastore for {} was added.", persistentClass);
return dataStore;