#!/bin/bash

SPARK_URL=http://d3kbcqa49mib13.cloudfront.net/spark-2.1.0-bin-hadoop2.7.tgz
SPARK_FILENAME=spark-2.1.0-bin-hadoop2.7.tgz

set -e

echo "Hello World"

apt-get update
apt-get -y install wget curl software-properties-common bzip2

# install openjdk
add-apt-repository -y ppa:openjdk-r/ppa
apt-get update
apt-get -y install openjdk-8-jdk

echo "Install miniconda"
    wget --quiet https://repo.continuum.io/miniconda/Miniconda3-4.1.11-Linux-x86_64.sh -O ~/miniconda.sh
    bash ~/miniconda.sh -b -p /home/conda
    rm ~/miniconda.sh
    export PATH="/home/conda/bin:$PATH"
    conda install -y nose numpy pandas

# Install Spark
curl $SPARK_URL > $HOME/$SPARK_FILENAME
tar -xzf $HOME/$SPARK_FILENAME -C $HOME/

echo 'export SPARK_HOME=$HOME/spark-2.1.0-bin-hadoop2.7/' >> $HOME/.bashrc && source $HOME/.bashrc

nosetests -vs pyspark-app-ci/tests/test_linear_regression.py

# show folders
find .

exit 0
#!/bin/bash

SPARK_URL=http://d3kbcqa49mib13.cloudfront.net/spark-2.1.0-bin-hadoop2.7.tgz
SPARK_FILENAME=spark-2.1.0-bin-hadoop2.7.tgz

set -e

echo "Hello World"

apt-get update
apt-get -y install wget curl software-properties-common bzip2

# install openjdk
add-apt-repository -y ppa:openjdk-r/ppa
apt-get update
apt-get -y install openjdk-8-jdk

# Install Miniconda
wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
    && /bin/bash ~/miniconda.sh -b -p $HOME/conda

cat $HOME/.bashrc

echo -e '\nexport PATH=$HOME/conda/bin:$PATH' >> $HOME/.bashrc && source $HOME/.bashrc

cat $HOME/.bashrc

# install Packages
$HOME/conda/bin/conda install -y nose numpy pandas

# Install Spark
curl $SPARK_URL > $HOME/$SPARK_FILENAME
tar -xzf $HOME/$SPARK_FILENAME -C $HOME/

echo 'export SPARK_HOME=$HOME/spark-2.1.0-bin-hadoop2.7/' >> $HOME/.bashrc && source $HOME/.bashrc

nosetests -vs pyspark-app-ci/tests/test_linear_regression.py

# show folders
find .
--- 
+++ 
@@ -15,12 +15,18 @@
 apt-get update
 apt-get -y install openjdk-8-jdk
 
-echo "Install miniconda"
-    wget --quiet https://repo.continuum.io/miniconda/Miniconda3-4.1.11-Linux-x86_64.sh -O ~/miniconda.sh
-    bash ~/miniconda.sh -b -p /home/conda
-    rm ~/miniconda.sh
-    export PATH="/home/conda/bin:$PATH"
-    conda install -y nose numpy pandas
+# Install Miniconda
+wget --quiet https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \
+    && /bin/bash ~/miniconda.sh -b -p $HOME/conda
+
+cat $HOME/.bashrc
+
+echo -e '\nexport PATH=$HOME/conda/bin:$PATH' >> $HOME/.bashrc && source $HOME/.bashrc
+
+cat $HOME/.bashrc
+
+# install Packages
+$HOME/conda/bin/conda install -y nose numpy pandas
 
 # Install Spark
 curl $SPARK_URL > $HOME/$SPARK_FILENAME
@@ -32,5 +38,3 @@
 
 # show folders
 find .
-
-exit 0
WIP: Change the way how conda is installed and remove source.

Signed-off-by: Andreas Fleig <bc7fff7983142405af66ee619818d9197fc2198e@pivotal.io>
