/data/svn/repos/hooks/post-commit 文件
#!/bin/bash 这是重点,默认sh不支持[[]]运算符
REPOS="$1"
REV="$2"
TXN_NAME="$3"
"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
SVNLOOK=/usr/bin/svnlook
SVN_PATH=$($SVNLOOK dirs-changed $REPOS)
#echo $REPOS >> /data/log.log
echo $SVN_PATH >> /data/log.log
if [[ ${SVN_PATH} =~ "integration" ]] #判断对于项目
then
echo "执行jenkins" >> /data/log.log
curl http://192.168.1.21:8080/job/political/build?token=integration-auto-build
else
echo "未执行jenkins?" >> /data/log.log
fi
######################
Jenkins北京时间设置
打开 【系统管理】->【脚本命令行】运行下面的命令
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')
Shell:
BUILD_ID=dontKillMe
cd $WORKSPACE/modules-web
mvn clean package -pl webstart -am
pid=$(ps -ef | grep server.port=8081 | grep -v grep | awk 'NR=1 {print $2}')
#kill原进程
if [ $pid ] ; then
kill $pid
fi
nohup java -jar -Xms512m -Xmx1024m -Dspring.profiles.active=dev -Dserver.port=8081 $WORKSPACE/modules-web/webstart/target/integration-webstart-0.0.1-SNAPSHOT.jar > $WORKSPACE/modules-web/webstart/target/integration.log &
Git to SVN
cd /data/jenkins/qtxy
(svn st edu/default/ | grep ? | xargs svn add) || true
svn commit -m "*"
systemd 配置 修改jenkins内存
/usr/lib/systemd/system/jenkins.service 文件
参考修改
Environment="JAVA_OPTS=-Djava.awt.headless=true -Xmx8g -Xms8g"
注意:本文归作者所有,未经作者允许,不得转载