jam-cloud/build

113 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# RUN_SLOW_TESTS, RUN_AWS_TESTS, SKIP_KARMA=1 SHOW_JS_ERRORS=1 PACKAGE=1
# WORKSPACE=/var/lib/jenkins/jobs/jam-web/workspace
set -e
export BUNDLE_JOBS=1 # 6, which i want to use, makes the whole server crawl
echo ""
echo "BUILDING JAM-PB"
pushd pb > /dev/null
bash -l ./jenkins
popd > /dev/null
echo ""
echo "BUILDING JAM-RUBY"
pushd ruby > /dev/null
rm -f *.gem
bash -l ./jenkins
popd > /dev/null
echo ""
echo "BUILDING WEBSOCKET GATEWAY"
pushd websocket-gateway > /dev/null
bash -l ./jenkins
popd > /dev/null
echo ""
echo "BUILDING JAM-WEB"
pushd web > /dev/null
echo "kill any stuck rspec tests from previous run. need to debug how/why this happens on build server"
set +e
ps aux | grep -ie "jam-cloud.*rspec" | awk '{print $2}' | xargs kill -9
set -e
PACKAGE=1 bash ./jenkins
# we do this so that the build won't fail in jenkins if no capybara error screenshot isn't there
mkdir -p tmp/capybara
touch tmp/capybara/success.png
popd > /dev/null
echo ""
echo "BUILDING JAM-ADMIN"
pushd admin /dev/null
bash -l ./jenkins
popd > /dev/null
if [ ! -z "$PACKAGE" ]; then
source /etc/lsb-release
DEB_SERVER=https://int.jamkazam.com:9010/apt-`uname -p`/$DISTRIB_CODENAME
GEM_SERVER=http://localhost:9000/gems
# if still going, then push all debs up
if [[ "$GIT_BRANCH" == *develop* || "$GIT_BRANCH" == *master* || "$GIT_BRANCH" == *release* || "$GIT_BRANCH" == *feature* || "$GIT_BRANCH" == *hotfix* || "$GIT_BRANCH" == *promised_based_api_interation* ]]; then
echo ""
echo "PUSHING WEB"
pushd web > /dev/null
echo "publishing ubuntu package (.deb)"
DEBPATH=`find target/deb -name *.deb`
DEBNAME=`basename $DEBPATH`
curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME
if [ "$?" != "0" ]; then
echo "deb publish failed"
exit 1
fi
echo "done publishing deb"
popd > /dev/null
echo ""
echo "PUSHING WEBSOCKET-GATEWAY"
pushd websocket-gateway > /dev/null
echo "publishing ubuntu package (.deb)"
DEBPATH=`find target/deb -name *.deb`
DEBNAME=`basename $DEBPATH`
curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME
if [ "$?" != "0" ]; then
echo "deb publish failed"
exit 1
fi
echo "done publishing deb"
popd > /dev/null
echo ""
echo "PUSHING ADMIN"
pushd admin > /dev/null
echo "publishing ubuntu package (.deb)"
DEBPATH=`find target/deb -name *.deb`
DEBNAME=`basename $DEBPATH`
curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME
if [ "$?" != "0" ]; then
echo "deb publish failed"
exit 1
fi
echo "done publishing deb"
popd > /dev/null
else
echo "Skipping publish since branch is not master, develop, or release/*. branch is $GIT_BRANCH"
fi
fi