- using ping to detect when ES is ready rather than sleep
- reusing es downloads to make local testing faster - periodic checks will kill the script on failure - coveralls report is only sent once per build - failures sending the coveralls report won't cause the build to fail
This commit is contained in:
@ -71,7 +71,7 @@ async.series([
|
||||
},
|
||||
function (done) {
|
||||
// checkout branch and clean it
|
||||
cp.spawn('git', ['submodule', 'foreach', 'git checkout origin/' + branch + ' && git clean -f'], {
|
||||
cp.spawn('git', ['submodule', 'foreach', 'git fetch origin master && git checkout origin/' + branch + ' && git clean -f'], {
|
||||
stdio: stdio
|
||||
}).on('exit', function (status) {
|
||||
done(status ? new Error('Unable to checkout ' + branch) : void 0);
|
||||
|
||||
@ -8,7 +8,6 @@ fi
|
||||
ROOT="$PWD"
|
||||
ES_SUBMODULE="$ROOT/src/elasticsearch"
|
||||
SNAPSHOTS="$ROOT/.snapshots"
|
||||
ES_BIN="$SNAPSHOTS/es/bin/elasticsearch"
|
||||
ES_VERSION="${ES_BRANCH}_nightly"
|
||||
ES_URL="http://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/$ES_BRANCH/nightly/JDK6/elasticsearch-latest-SNAPSHOT.zip"
|
||||
|
||||
@ -17,63 +16,97 @@ if [ ! -z $ES_RELEASE ]; then
|
||||
ES_URL="https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-${ES_RELEASE}.zip"
|
||||
fi
|
||||
|
||||
echo -en 'travis_fold:start:setup_es\\r'
|
||||
if [ -d $SNAPSHOTS ]; then
|
||||
echo "wiping out existing snapshots"
|
||||
rm -rf $SNAPSHOTS
|
||||
ES_DIR="$SNAPSHOTS/$ES_VERSION"
|
||||
ES_BIN="$ES_DIR/bin/elasticsearch"
|
||||
|
||||
function fold {
|
||||
echo -e "travis_fold:$1"
|
||||
if [[ $1 =~ ^end ]]; then
|
||||
echo ""
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function check {
|
||||
RESULT=$1
|
||||
if [ "$RESULT" -gt "0" ]; then
|
||||
echo "non-zero exit code: $RESULT"
|
||||
exit $RESULT
|
||||
fi
|
||||
}
|
||||
|
||||
fold "start:setup_es"
|
||||
echo "Setting up elasticsearch"
|
||||
|
||||
echo "Killing existsing java processes"
|
||||
killall java 2>/dev/null
|
||||
|
||||
echo "Downloading Elasticsearch $ES_VERSION to $SNAPSHOTS"
|
||||
mkdir $SNAPSHOTS &&
|
||||
cd $SNAPSHOTS \
|
||||
&& curl -O $ES_URL \
|
||||
&& unzip elasticsearch-*.zip \
|
||||
if [ ! -d "$SNAPSHOTS" ]; then
|
||||
mkdir $SNAPSHOTS
|
||||
fi
|
||||
|
||||
cd $SNAPSHOTS
|
||||
|
||||
if [ ! -d "$ES_DIR" ]; then
|
||||
echo "Downloading Elasticsearch $ES_VERSION to $ES_DIR"
|
||||
|
||||
|
||||
curl -O $ES_URL \
|
||||
&& unzip elasticsearch-*.zip
|
||||
check $?
|
||||
|
||||
rm elasticsearch-*.zip
|
||||
check $?
|
||||
|
||||
mv elasticsearch-*/ $ES_DIR
|
||||
check $?
|
||||
fi
|
||||
|
||||
cd $ROOT
|
||||
|
||||
if [ ! -d $SNAPSHOTS ]; then
|
||||
echo "Failed to download ES"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
mv $SNAPSHOTS/elasticsearch-*/ $SNAPSHOTS/es/
|
||||
|
||||
if [ ! -x $ES_BIN ]; then
|
||||
echo "Unable to find elasticsearch binary $ES_BIN"
|
||||
if [ ! -x "$ES_BIN" ]; then
|
||||
echo "Unable to find elasticsearch executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $ES_BRANCH = "0.90" ]; then
|
||||
if [ "$ES_BRANCH" = "0.90" ]; then
|
||||
echo "Starting Elasticsearch $ES_VERSION"
|
||||
$ES_BIN \
|
||||
-Des.network.host=localhost \
|
||||
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||
-Des.discovery.zen.ping_timeout=1
|
||||
check $?
|
||||
else
|
||||
echo "Starting Elasticsearch $ES_VERSION as a deamon"
|
||||
$ES_BIN -d \
|
||||
-Des.network.host=localhost \
|
||||
-Des.discovery.zen.ping.multicast.enabled=false \
|
||||
-Des.discovery.zen.ping_timeout=1
|
||||
check $?
|
||||
fi
|
||||
fold "end:setup_es"
|
||||
|
||||
sleep 3
|
||||
echo -en 'travis_fold:end:setup_es\\r\\n'
|
||||
|
||||
echo -en 'travis_fold:start:install_grunt\\r'
|
||||
npm install -g grunt-cli
|
||||
echo -en 'travis_fold:end:install_grunt\\r'
|
||||
|
||||
if [ $NO_UNIT = "true" ]; then
|
||||
grunt --es_branch="=$ES_BRANCH" run:generate_yaml_tests mochacov:integration
|
||||
RESULT=$?
|
||||
else
|
||||
grunt --es_branch="=$ES_BRANCH" jshint mochacov:unit run:generate_yaml_tests mochacov:integration mochacov:ship_coverage
|
||||
RESULT=$?
|
||||
if [ ! -x "`which grunt`" ]; then
|
||||
fold "start:install_grunt"
|
||||
echo "installing grunt-cli"
|
||||
npm install -g grunt-cli
|
||||
check $?
|
||||
fold "end:install_grunt"
|
||||
fi
|
||||
|
||||
killall java 2>/dev/null
|
||||
exit $RESULT
|
||||
if [ -z "$NO_UNIT" ]; then
|
||||
grunt jshint mochacov:unit
|
||||
check $?
|
||||
fi
|
||||
|
||||
if [ -z "$NO_INTEGRATION" ]; then
|
||||
grunt --es_branch="=$ES_BRANCH" run:generate_yaml_tests mochacov:integration
|
||||
check $?
|
||||
fi
|
||||
|
||||
if [ -n "$COVERAGE" ]; then
|
||||
grunt mochacov:ship_coverage
|
||||
fi
|
||||
|
||||
killall java 2>/dev/null
|
||||
Reference in New Issue
Block a user