jam-cloud/build

121 lines
3.1 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 ""
service postgresql start
su postgres -c "psql -U postgres -c \"CREATE DATABASE jam\""
su postgres -c "psql -c \"ALTER USER postgres WITH PASSWORD 'postgres'\""
echo "BUILDING JAM-RUBY"
pushd ruby > /dev/null
rm -f *.gem
bash -l ./jenkins
popd > /dev/null
echo ""
export SKIP_TESTS=1
echo "BUILDING WEBSOCKET GATEWAY"
pushd websocket-gateway > /dev/null
PACKAGE=1 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
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
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
PACKAGE=1 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* ]]; 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