#!/bin/sh # ci.sh # This script for build go projects. # @version 170327:2 # @author zhangxuhong # # [ci] echo "-[ci]-" echo "start" # ----------------------------[manual config here]------------------------------ # base config REPO_SRC=/data/repo/baidu_link_submit_ms BUILD_TARGET=baidu_link_submit_ms # fetch source config go_packages=( "github.com/astaxie/beego" ) http_proxy="" # deploy config DEPLOY_SRC=/data/repo DEPLOY_LOG_SRC=/data/logs ACTION=$1 RELEASE_ENV=$2 DEV_ENV_LOCATION=( "root@192.168.0.203" ) BETA_ENV_LOCATION=( "root@192.168.0.222" ) ONLINE_ENV_LOCATION=( "root@192.168.100.42" # microservice03v "root@192.168.100.44" # microservice04v "root@192.168.100.46" # microservice04v ) # ------------------------------------------------------------------------------ # check if release env fit repo src NOW_PWD=`pwd` if [ "$NOW_PWD" != "${REPO_SRC}/scripts" ] && [ "$NOW_PWD" != "${REPO_SRC}" ]; then echo -e "\033[43m[WARRING!] PWD is ${NOW_PWD}, but REPO_SRC is ${REPO_SRC} \033[0m"; echo -e "please check your REPO_SRC config to make sure that you config this file correctly."; exit 1; fi # run scripts SCRIPTS_SRC="${REPO_SRC}/scripts/ci" if [ "${ACTION}" == "build" ]; then . "${SCRIPTS_SRC}/fetch_source.sh" . "${SCRIPTS_SRC}/build.sh" elif [ "${ACTION}" == "release" ]; then . "${SCRIPTS_SRC}/fetch_source.sh" . "${SCRIPTS_SRC}/build.sh" . "${SCRIPTS_SRC}/deploy.sh" elif [ "${ACTION}" == "run_bee" ]; then . "${SCRIPTS_SRC}/run_bee.sh" else echo "usage:" echo "./ci.sh [action: build/release/run_bee] [beta/online/bee_path]" echo "" echo "e.g." echo "./ci.sh release beta" echo "" fi echo "end"