You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by ke...@apache.org on 2020/09/07 15:33:21 UTC
[usergrid] branch master updated: Fix build pipeline
This is an automated email from the ASF dual-hosted git repository.
keyur pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/usergrid.git
The following commit(s) were added to refs/heads/master by this push:
new 7263c17 Fix build pipeline
7263c17 is described below
commit 7263c1759566a3c50855d7a5a8c9b9044f01c1b4
Author: Keyur Karnik <ke...@gmail.com>
AuthorDate: Mon Sep 7 08:24:20 2020 -0700
Fix build pipeline
Rewrote Jenkins pipeline to fix flaky C* behavior
Added travis pipeline
---
.travis.yml | 29 +++++++++++++++++
stack/Jenkinsfile | 96 ++++++++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 114 insertions(+), 11 deletions(-)
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..d4bc36a
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+dist: trusty
+language: java
+
+jdk:
+ - oraclejdk8
+
+before_install:
+ - git clone https://github.com/apache/usergrid-java
+ - cd usergrid-java
+ - mvn -q clean install -DskipTests=true
+
+ - cd ..
+ - sudo rm -rf /var/lib/cassandra/*
+ - wget http://archive.apache.org/dist/cassandra/2.1.20/apache-cassandra-2.1.20-bin.tar.gz
+ - tar -xvzf apache-cassandra-2.1.20-bin.tar.gz
+ - sudo sh apache-cassandra-2.1.20/bin/cassandra
+
+ - curl -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.deb
+ - sudo dpkg -i --force-confnew elasticsearch-1.7.5.deb
+ - sudo service elasticsearch restart
+ - sleep 180
+
+ - cd stack
+
+services:
+ - elasticsearch
+
+script:
+ - mvn -q clean install
diff --git a/stack/Jenkinsfile b/stack/Jenkinsfile
index 05d8017..aebb217 100644
--- a/stack/Jenkinsfile
+++ b/stack/Jenkinsfile
@@ -19,6 +19,11 @@
pipeline {
agent { label 'ubuntu' }
+ environment {
+ CASS_HOME = "${WORKSPACE}/temp/apache-cassandra-2.1.20"
+ ES_HOME = "${WORKSPACE}/temp/elasticsearch-1.7.5"
+ }
+
tools {
maven 'Maven 3 (latest)'
jdk 'JDK 1.8 (latest)'
@@ -54,31 +59,63 @@ pipeline {
}
}
- stage ('Start C* and ES') {
+ stage ('Setup C*, ES and Code') {
steps {
sh '''
- mkdir -p temp
- cd temp
+ mkdir -p $WORKSPACE/temp
+ cd $WORKSPACE/temp
rm -rf *
wget http://archive.apache.org/dist/cassandra/2.1.20/apache-cassandra-2.1.20-bin.tar.gz
tar -xvf apache-cassandra-2.1.20-bin.tar.gz
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.tar.gz
tar -xvf elasticsearch-1.7.5.tar.gz
- apache-cassandra-2.1.20/bin/cassandra
- elasticsearch-1.7.5/bin/elasticsearch -d
- cd ..
- echo "Started C* and ES. Waiting 3 mins before starting tests ..."
- sleep 180
+ echo "Setup C* and ES."
'''
+ git 'https://github.com/apache/usergrid.git'
}
}
- stage ('Build Usergrid Stack') {
+ stage ('Build Usergrid Stack Grp 1') {
steps {
- git 'https://github.com/apache/usergrid.git'
+ startDBs()
sh '''
- mvn clean install -f stack/pom.xml
+ mvn clean install -f stack/build-tools/pom.xml
+ mvn clean install -f stack/config/pom.xml
+ mvn clean install -f stack/corepersistence/pom.xml
+ mvn clean install -f stack/core/pom.xml
'''
+ stopDBs()
+ }
+ }
+
+ stage ('Build Usergrid Stack Grp 2') {
+ steps {
+ startDBs()
+ sh '''
+ mvn clean install -f stack/services/pom.xml
+ '''
+ stopDBs()
+ }
+ }
+
+ stage ('Build Usergrid Stack Grp 3') {
+ steps {
+ startDBs()
+ sh '''
+ mvn clean install -f stack/rest/pom.xml
+ '''
+ stopDBs()
+ }
+ }
+
+ stage ('Build Usergrid Stack Grp 4') {
+ steps {
+ startDBs()
+ sh '''
+ mvn clean install -f stack/tools/pom.xml
+ mvn clean install -f stack/query-validator/pom.xml
+ '''
+ stopDBs()
}
}
@@ -111,3 +148,40 @@ pipeline {
}
}
+
+def stopDBs() {
+ sh '''
+ echo "Stopping C* and ES ..."
+
+ $CASS_HOME/bin/nodetool status
+ $CASS_HOME/bin/nodetool drain
+ kill -9 $(pgrep -if 'cassandra')
+ kill -9 $(pgrep -if 'elastic')
+ ps -ef | grep -i cassandra
+ ps -ef | grep -i elastic
+ rm -rf $CASS_HOME/data/*
+ rm -rf $CASS_HOME/logs/*
+ rm -rf $ES_HOME/data/*
+ rm -rf $ES_HOME/logs/*
+
+ echo "Stopped C* and ES."
+ '''
+}
+
+def startDBs() {
+ sh '''
+ echo "Starting C* and ES ..."
+
+ $CASS_HOME/bin/cassandra
+ $ES_HOME/bin/elasticsearch -d
+
+ echo "Started C* and ES. Waiting 1 min before starting tests ..."
+ sleep 60
+ '''
+}
+
+
+def resetState() {
+ stopDBs()
+ startDBs()
+}