|
19 | 19 | pipeline { |
20 | 20 | agent { label 'ubuntu' } |
21 | 21 |
|
| 22 | + environment { |
| 23 | + CASS_HOME = "${WORKSPACE}/temp/apache-cassandra-2.1.20" |
| 24 | + ES_HOME = "${WORKSPACE}/temp/elasticsearch-1.7.5" |
| 25 | + } |
| 26 | + |
22 | 27 | tools { |
23 | 28 | maven 'Maven 3 (latest)' |
24 | 29 | jdk 'JDK 1.8 (latest)' |
@@ -54,31 +59,63 @@ pipeline { |
54 | 59 | } |
55 | 60 | } |
56 | 61 |
|
57 | | - stage ('Start C* and ES') { |
| 62 | + stage ('Setup C*, ES and Code') { |
58 | 63 | steps { |
59 | 64 | sh ''' |
60 | | - mkdir -p temp |
61 | | - cd temp |
| 65 | + mkdir -p $WORKSPACE/temp |
| 66 | + cd $WORKSPACE/temp |
62 | 67 | rm -rf * |
63 | 68 | wget http://archive.apache.org/dist/cassandra/2.1.20/apache-cassandra-2.1.20-bin.tar.gz |
64 | 69 | tar -xvf apache-cassandra-2.1.20-bin.tar.gz |
65 | 70 | wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.tar.gz |
66 | 71 | tar -xvf elasticsearch-1.7.5.tar.gz |
67 | | - apache-cassandra-2.1.20/bin/cassandra |
68 | | - elasticsearch-1.7.5/bin/elasticsearch -d |
69 | | - cd .. |
70 | | - echo "Started C* and ES. Waiting 3 mins before starting tests ..." |
71 | | - sleep 180 |
| 72 | + echo "Setup C* and ES." |
72 | 73 | ''' |
| 74 | + git 'https://github.com/apache/usergrid.git' |
73 | 75 | } |
74 | 76 | } |
75 | 77 |
|
76 | | - stage ('Build Usergrid Stack') { |
| 78 | + stage ('Build Usergrid Stack Grp 1') { |
77 | 79 | steps { |
78 | | - git 'https://github.com/apache/usergrid.git' |
| 80 | + startDBs() |
79 | 81 | sh ''' |
80 | | - mvn clean install -f stack/pom.xml |
| 82 | + mvn clean install -f stack/build-tools/pom.xml |
| 83 | + mvn clean install -f stack/config/pom.xml |
| 84 | + mvn clean install -f stack/corepersistence/pom.xml |
| 85 | + mvn clean install -f stack/core/pom.xml |
81 | 86 | ''' |
| 87 | + stopDBs() |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + stage ('Build Usergrid Stack Grp 2') { |
| 92 | + steps { |
| 93 | + startDBs() |
| 94 | + sh ''' |
| 95 | + mvn clean install -f stack/services/pom.xml |
| 96 | + ''' |
| 97 | + stopDBs() |
| 98 | + } |
| 99 | + } |
| 100 | + |
| 101 | + stage ('Build Usergrid Stack Grp 3') { |
| 102 | + steps { |
| 103 | + startDBs() |
| 104 | + sh ''' |
| 105 | + mvn clean install -f stack/rest/pom.xml |
| 106 | + ''' |
| 107 | + stopDBs() |
| 108 | + } |
| 109 | + } |
| 110 | + |
| 111 | + stage ('Build Usergrid Stack Grp 4') { |
| 112 | + steps { |
| 113 | + startDBs() |
| 114 | + sh ''' |
| 115 | + mvn clean install -f stack/tools/pom.xml |
| 116 | + mvn clean install -f stack/query-validator/pom.xml |
| 117 | + ''' |
| 118 | + stopDBs() |
82 | 119 | } |
83 | 120 | } |
84 | 121 |
|
@@ -111,3 +148,40 @@ pipeline { |
111 | 148 |
|
112 | 149 | } |
113 | 150 | } |
| 151 | + |
| 152 | +def stopDBs() { |
| 153 | + sh ''' |
| 154 | + echo "Stopping C* and ES ..." |
| 155 | +
|
| 156 | + $CASS_HOME/bin/nodetool status |
| 157 | + $CASS_HOME/bin/nodetool drain |
| 158 | + kill -9 $(pgrep -if 'cassandra') |
| 159 | + kill -9 $(pgrep -if 'elastic') |
| 160 | + ps -ef | grep -i cassandra |
| 161 | + ps -ef | grep -i elastic |
| 162 | + rm -rf $CASS_HOME/data/* |
| 163 | + rm -rf $CASS_HOME/logs/* |
| 164 | + rm -rf $ES_HOME/data/* |
| 165 | + rm -rf $ES_HOME/logs/* |
| 166 | +
|
| 167 | + echo "Stopped C* and ES." |
| 168 | + ''' |
| 169 | +} |
| 170 | + |
| 171 | +def startDBs() { |
| 172 | + sh ''' |
| 173 | + echo "Starting C* and ES ..." |
| 174 | +
|
| 175 | + $CASS_HOME/bin/cassandra |
| 176 | + $ES_HOME/bin/elasticsearch -d |
| 177 | +
|
| 178 | + echo "Started C* and ES. Waiting 1 min before starting tests ..." |
| 179 | + sleep 60 |
| 180 | + ''' |
| 181 | +} |
| 182 | + |
| 183 | + |
| 184 | +def resetState() { |
| 185 | + stopDBs() |
| 186 | + startDBs() |
| 187 | +} |
0 commit comments