set -x
if test -e db
then
   echo "db exist, skip git"
else
  git clone "https://${GIT_USER}:${GIT_PASSWORD}@e.coding.net/epm2/epm/db.git"
fi
mkdir -p hana/db
cp -r db/postgre db/*.sql hana/db
cd ${JK_CACHE} #epm tools in nfs
cp -rf hana/* ${WORKSPACE}/hana
cp -rf mongo/* ${WORKSPACE}/mongo
cp -rf node/* ${WORKSPACE}/node
cp `ls -ltr ${JK_BUILD_CACHE}/cons-build-cons_master*.tar | tail -1 | awk '{print \$9}'` ${WORKSPACE}/node
#pg
cp -rf pg/* ${WORKSPACE}/pg
#monitor
cp -rf monitor/* ${WORKSPACE}/monitor

#chmod/dos2unix

#tar
cd ${WORKSPACE}
chmod a+x hana/*.sh mongo/*.sh node/*.sh pg/*.sh monitor/*.sh
dos2unix hana/*.sh mongo/*.sh node/*.sh pg/*.sh monitor/*.sh
tar zcf node.tar node
tar zcf hana.tar hana
tar zcf mongo.tar mongo
tar zcf monitor.tar monitor
tar czf privateInstall.tar *.tar

scp -i /home/epm/.ssh/id_rsa -o StrictHostKeyChecking=no *.jar epm@cicdcache.epmtest.cn:/mnt/datadisk0/private_deploy/