Jenkins automatically build when SVN submit

#!/bin/bash
function svn_commit()
{
        local ret 
        echo "$svn_msg"|grep 'v1.1.1' &> /dev/null
        ret=$?
        if [ $ret -ne 0 ]
        then
                echo "提交信息中没有版本号"
                exit 1
        fi
        if [ -d $local_svn/$task_type/$svn_item_dir ]
        then
                svn delete -m "$svn_msg" $svn_addr/$task_type/$svn_item_dir --username amos.lu --password llm.6765082
                rm -rf $local_svn/$task_type/$svn_item_dir
                mkdir $local_svn/$task_type/$svn_item_dir
                cp -r /dev/shm/$ITEM/* $local_svn/$task_type/$svn_item_dir
                cd $local_svn/$task_type/
                svn import -m "$svn_msg" $svn_item_dir $svn_addr/$task_type/$svn_item_dir --username amos.lu --password llm.6765082
                rm -rf  $local_svn/$task_type/$svn_item_dir/
                svn update
        else
                mkdir $local_svn/$task_type/$svn_item_dir
                cp -r /dev/shm/$ITEM/* $local_svn/$task_type/$svn_item_dir
                cd $local_svn/$task_type
                svn import -m "$svn_msg" $svn_item_dir $svn_addr/$task_type/$svn_item_dir --username amos.lu --password llm.6765082
                rm -rf  $local_svn/$task_type/$svn_item_dir/
                svn update
        fi
}

    http://linuxg.blog.51cto.com/4410110/1790033

相关推荐