|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +pipeline { |
| 19 | + agent { label 'ubuntu' } |
| 20 | + |
| 21 | + tools { |
| 22 | + maven 'Maven 3 (latest)' |
| 23 | + jdk 'JDK 1.8 (latest)' |
| 24 | + } |
| 25 | + |
| 26 | + options { |
| 27 | + timeout(time: 30, unit: 'MINUTES') |
| 28 | + } |
| 29 | + |
| 30 | + |
| 31 | + stages { |
| 32 | + stage ('Initialize') { |
| 33 | + steps { |
| 34 | + sh ''' |
| 35 | + echo "PATH = ${PATH}" |
| 36 | + echo "M2_HOME = ${M2_HOME}" |
| 37 | + ''' |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + stage ('Build Usergrid-Java') { |
| 42 | + steps { |
| 43 | + git 'https://github.com/apache/usergrid-java.git' |
| 44 | + sh ''' |
| 45 | + mvn clean install -DskipTests=true |
| 46 | + ''' |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + stage ('Start C* and ES') { |
| 51 | + steps { |
| 52 | + sh ''' |
| 53 | + mkdir -p temp |
| 54 | + cd temp |
| 55 | + rm -rf * |
| 56 | + wget http://archive.apache.org/dist/cassandra/2.1.20/apache-cassandra-2.1.20-bin.tar.gz |
| 57 | + tar -xvf apache-cassandra-2.1.20-bin.tar.gz |
| 58 | + wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.5.tar.gz |
| 59 | + tar -xvf elasticsearch-1.7.5.tar.gz |
| 60 | + apache-cassandra-2.1.20/bin/cassandra |
| 61 | + elasticsearch-1.7.5/bin/elasticsearch -d |
| 62 | + cd .. |
| 63 | + echo "Started C* and ES. Waiting 3 mins before starting tests ..." |
| 64 | + sleep 180 |
| 65 | + ''' |
| 66 | + } |
| 67 | + } |
| 68 | + |
| 69 | + stage ('Build Usergrid Stack') { |
| 70 | + steps { |
| 71 | + git 'https://github.com/apache/usergrid.git' |
| 72 | + sh ''' |
| 73 | + mvn clean install -DskipTests=true -f stack/pom.xml |
| 74 | + ''' |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + post { |
| 80 | + always { |
| 81 | + echo 'End of pipeline' |
| 82 | + junit 'stack/**/surefire-reports/*.xml' |
| 83 | + sh 'ps -ef | grep cassandra' |
| 84 | + sh 'ps -ef | grep elastic' |
| 85 | + deleteDir() /* clean up our workspace */ |
| 86 | + } |
| 87 | + success { |
| 88 | + echo 'Usergrid build and tests succeeded' |
| 89 | + } |
| 90 | + failure { |
| 91 | + echo 'Usergrid build and/or tests failed' |
| 92 | + } |
| 93 | + |
| 94 | + } |
| 95 | +} |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | + |
0 commit comments