diff --git a/BCLOUD b/BCLOUD index 99c73c379..d2420f7b8 100644 --- a/BCLOUD +++ b/BCLOUD @@ -1 +1 @@ -BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph -c "cd baidu/xbu-data/hugegraph && sh build.sh $REPO_USER" -u ./ +BUILD_SUBMITTER -x -e CENTOS6U3 -m baidu/xbu-data/hugegraph -c "export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ && export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ && export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH && cd baidu/xbu-data/hugegraph && sh build.sh" -u ./ diff --git a/build.sh b/build.sh index 0511a5f96..43191e263 100644 --- a/build.sh +++ b/build.sh @@ -20,12 +20,5 @@ export MAVEN_HOME=/home/scmtools/buildkit/maven/apache-maven-3.3.9/ export JAVA_HOME=/home/scmtools/buildkit/java/jdk1.8.0_25/ export PATH=$JAVA_HOME/bin:$MAVEN_HOME/bin:$PATH -if [ "$#" -eq "0" ] - then - echo "No argument supplied,use default store" -else - STORE=$1 - echo "Set store=hugegraph_$STORE" - sed -i "s/.*store=.*/store=hugegraph_$STORE/" hugegraph-test/src/main/resources/hugegraph.properties -fi -mvn clean package +mvn clean compile + diff --git a/hugegraph-dist/src/assembly/static/bin/jenkins.sh b/hugegraph-dist/src/assembly/static/bin/jenkins.sh new file mode 100644 index 000000000..81fa1695a --- /dev/null +++ b/hugegraph-dist/src/assembly/static/bin/jenkins.sh @@ -0,0 +1,101 @@ +#!/usr/bin/env bash + +ACTION=${ACTION} +BUILD_ID=${AGILE_COMPILE_BUILD_ID} +BRANCH_REF=${AGILE_COMPILE_BRANCH_REF} + +USER="liunanke" +REPO="hugegraph" +REPO_URL="icode.baidu.com:8235/baidu/xbu-data/$REPO" +OUTPUT="hugegraph-release-*.tar.gz" +RELEASE_SERVER="yq01-sw-hdsserver16.yq01.baidu.com 8222" +RELEASE_SERVER_USER=${FTP_USER} + +CONF="hugegraph-test/src/main/resources/hugegraph.properties" +STORE="hugegraph_$BUILD_ID" +HOST="yq01-sw-hugegraph01.yq01.baidu.com" +PORT="8052" + +# Clone code from repo if necessary +if [ ! -d $REPO ]; then + echo "Clone code from repo..." + git clone ssh://$USER@$REPO_URL + if [ $? -ne 0 ]; then + echo "Failed to clone code." + exit 1 + fi +fi + +# Change dir into local repo +cd $REPO +if [ $? -ne 0 ]; then + echo "Failed to cd $REPO." + exit 1 +fi + +# Fetch code from repo if necessary +if [ -n "$BRANCH_REF" ]; then + echo "Fetch code from repo: ${BRANCH_REF}..." + git fetch ssh://$USER@$REPO_URL ${BRANCH_REF} && git checkout FETCH_HEAD + if [ $? -ne 0 ]; then + echo "Failed to fetch code." + exit 1 + fi +fi + +# Set options into conf of core-test +echo "Set conf options: $STORE $HOST $PORT" +sed -i "s/store=.*/store=$STORE/" $CONF +sed -i "s/cassandra\.host=.*/cassandra\.host=$HOST/" $CONF +sed -i "s/cassandra\.port=.*/cassandra\.port=$PORT/" $CONF + +# Build and test +if [ $ACTION = "build" ]; then + + echo "Start build..." + + mvn clean package + if [ $? -ne 0 ]; then + echo "Failed to build or test." + exit 1 + fi + + echo "Finish build." + +# Deploy or publish +elif [ $ACTION = "deploy" ]; then + + echo "Start deploy..." + + mvn clean package + if [ $? -ne 0 ]; then + echo "Failed to build or test." + exit 1 + fi + + echo "Upload $OUTPUT to release server $RELEASE_SERVER..." + ftp -n <<- FTP_EOF + open $RELEASE_SERVER + user $RELEASE_SERVER_USER + cd /download/$REPO + bin + put $OUTPUT + bye +FTP_EOF + + if [ $? -ne 0 ]; then + echo "Failed to upload." + exit 1 + fi + + # Use maven-deploy plugin instead if 401 error + echo "Deploy maven packages..." + mvn deploy -DskipTests + if [ $? -ne 0 ]; then + echo "Failed to deploy." + exit 1 + fi + + echo "Finish deploy." + +fi diff --git a/hugegraph-test/src/main/resources/hugegraph.properties b/hugegraph-test/src/main/resources/hugegraph.properties index 7f83c7590..cf02ee632 100644 --- a/hugegraph-test/src/main/resources/hugegraph.properties +++ b/hugegraph-test/src/main/resources/hugegraph.properties @@ -9,5 +9,5 @@ store.graph=huge_graph store.index=huge_index # cassandra backend config -cassandra.host=yq01-sw-hugegraph01.yq01.baidu.com -cassandra.port=8052 +cassandra.host=localhost +cassandra.port=9042