From d8cb2c72c41f61cea460b5e5e6dd8f428bcbba2d Mon Sep 17 00:00:00 2001 From: Chris Doughty Date: Sun, 5 Jan 2014 21:35:22 -0600 Subject: [PATCH] VRFS-951 Pushing only develop or master branch files as debians --- admin/jenkins | 20 ++++++++------ db/jenkins | 57 ++++++++++++++++++++------------------- web/jenkins | 20 ++++++++------ websocket-gateway/jenkins | 10 ++++--- 4 files changed, 60 insertions(+), 47 deletions(-) diff --git a/admin/jenkins b/admin/jenkins index 67733e8c2..cfc6734ab 100755 --- a/admin/jenkins +++ b/admin/jenkins @@ -9,17 +9,21 @@ if [ "$?" = "0" ]; then echo "build succeeded" if [ ! -z "$PACKAGE" ]; then - echo "publishing ubuntu package (.deb)" - DEBPATH=`find target/deb -name *.deb` - DEBNAME=`basename $DEBPATH` + if [[ "$GIT_BRANCH" == *develop* || "$GIT_BRANCH" == *master* ]]; then + echo "publishing ubuntu package (.deb)" + DEBPATH=`find target/deb -name *.deb` + DEBNAME=`basename $DEBPATH` - curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME + curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME - if [ "$?" != "0" ]; then - echo "deb publish failed" - exit 1 + if [ "$?" != "0" ]; then + echo "deb publish failed" + exit 1 + fi + echo "done publishing deb" + else + echo "Skipping publish since branch is neither master or develop..." fi - echo "done publishing deb" fi else echo "build failed" diff --git a/db/jenkins b/db/jenkins index 8d2afbc49..3c3f5b055 100755 --- a/db/jenkins +++ b/db/jenkins @@ -7,38 +7,39 @@ echo "starting build..." ./build if [ "$?" = "0" ]; then - echo "build succeeded" - echo "publishing gem" - pushd "target/ruby_package" - find . -name *.gem -exec curl -f -T {} $GEM_SERVER/{} \; - - if [ "$?" != "0" ]; then - echo "publish failed" - exit 1 - fi - popd - echo "done publishing gems" + echo "build succeeded" + if [[ "$GIT_BRANCH" == *develop* || "$GIT_BRANCH" == *master* ]]; then + echo "publishing gem" + pushd "target/ruby_package" + find . -name *.gem -exec curl -f -T {} $GEM_SERVER/{} \; - if [ ! -z "$PACKAGE" ]; then - echo "publishing ubuntu packages (.deb)" - for f in `find target -name '*.deb'`; do - DEBNAME=`basename $f` - DEBPATH="$f" - echo "publishing $DEBPATH to deb server" - curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME - - if [ "$?" != "0" ]; then - echo "deb publish failed of $DEBPATH" - exit 1 - fi - done + if [ "$?" != "0" ]; then + echo "publish failed" + exit 1 + fi - echo "done publishing debs" + popd + echo "done publishing gems" + + if [ ! -z "$PACKAGE" ]; then + echo "publishing ubuntu packages (.deb)" + for f in `find target -name '*.deb'`; do + DEBNAME=`basename $f` + DEBPATH="$f" + echo "publishing $DEBPATH to deb server" + curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME + if [ "$?" != "0" ]; then + echo "deb publish failed of $DEBPATH" + exit 1 + fi + done + + echo "done publishing debs" + fi + else + echo "Skipping publish since branch is neither master or develop..." fi - else echo "build failed" exit 1 fi - - diff --git a/web/jenkins b/web/jenkins index 67733e8c2..cfc6734ab 100755 --- a/web/jenkins +++ b/web/jenkins @@ -9,17 +9,21 @@ if [ "$?" = "0" ]; then echo "build succeeded" if [ ! -z "$PACKAGE" ]; then - echo "publishing ubuntu package (.deb)" - DEBPATH=`find target/deb -name *.deb` - DEBNAME=`basename $DEBPATH` + if [[ "$GIT_BRANCH" == *develop* || "$GIT_BRANCH" == *master* ]]; then + echo "publishing ubuntu package (.deb)" + DEBPATH=`find target/deb -name *.deb` + DEBNAME=`basename $DEBPATH` - curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME + curl -f -T $DEBPATH $DEB_SERVER/$DEBNAME - if [ "$?" != "0" ]; then - echo "deb publish failed" - exit 1 + if [ "$?" != "0" ]; then + echo "deb publish failed" + exit 1 + fi + echo "done publishing deb" + else + echo "Skipping publish since branch is neither master or develop..." fi - echo "done publishing deb" fi else echo "build failed" diff --git a/websocket-gateway/jenkins b/websocket-gateway/jenkins index c9d07babe..6715819d4 100755 --- a/websocket-gateway/jenkins +++ b/websocket-gateway/jenkins @@ -9,6 +9,8 @@ echo "starting build..." if [ "$?" = "0" ]; then echo "build succeeded" + if [[ "$GIT_BRANCH" == *develop* || "$GIT_BRANCH" == *master* ]]; then + # generate gem version based on jenkins build number if [ -z $BUILD_NUMBER ]; then BUILD_NUMBER="1" @@ -20,14 +22,14 @@ module JamWebsockets VERSION = "$VERSION" end EOF - + gem build jam_websockets.gemspec GEMNAME="jam_websockets-${VERSION}.gem" echo "publishing gem" curl -f -T $GEMNAME $GEM_SERVER/$GEMNAME - + if [ "$?" != "0" ]; then echo "gem publish failed" exit 1 @@ -47,8 +49,10 @@ EOF fi echo "done publishing deb" - fi + else + echo "Skipping publish since branch is neither master or develop..." + fi else echo "build failed" exit 1