Jenkins

 

20240912

如何改变 jenkins 家目录?

环境变量中配置 JENKINS_HOME

 

 

20240827

jenkins,版本:2.452.1 

基于 Role-based Authorization StrategyVersion 配置权限 

 

 

 

 

20240709

jenkins 加载页面特别慢

https://blog.csdn.net/DarkComxEating/article/details/139155651

 

20240523

通过Docker部署Java项目的日志输出到宿主机指定目录

https://www.cnblogs.com/linnuo/p/15699121.html

  

 

Post Steps

echo ${BUILD_NUMBER} >> /home/xiluhua/test.log
echo $JOB_NAME >> /home/xiluhua/test.log
echo $JENKINS_HOME/jobs/$JOB_NAME

/home/xiluhua/application/tomcat/auto-deploy.sh $JENKINS_HOME/jobs/$JOB_NAME ${BUILD_NUMBER} 8080

版本1:auto-deploy.sh

#!/bin/bash
# auth: xiluhua
# date: 2017-07-26
# params:
#        $1: $JENKINS_HOME/jobs/$JOB_NAME
#        $2: ${BUILD_NUMBER} 
#        #3: PORT
cd $1
echo $1
echo $2
echo $3
 
cp $(find -name *.war|grep $2) ~/application/tomcat/8080/apache-tomcat-8.0.45/webapps/docs
ssh -l xiluhua 192.168.178.132 "/home/xiluhua/application/tomcat/restart.sh $3"

版本2:auto-deploy.sh

weblogic@etpmalldev4 ~$ less /home/weblogic/application/tomcat/auto-deploy.sh
#!/bin/bash
# auth: xiluhua
# date: 2017-07-26
# params:
#        $1: $JENKINS_HOME/workspace/$JOB_NAME
#        $2: ${BUILD_NUMBER} 
#        $3: TARGET HOST IP
#        #4: PORT
#        #5: PROJECT NAME
echo $1
echo $2
echo $3
echo $4
echo $5
 
cd $1
cp $(find -name *.war) ~/application/tomcat/8082/apache-tomcat-8.0.45/webapps/docs/$5.war
ssh -l weblogic $3 "/home/weblogic/application/tomcat/restart.sh $4 $5"

 

restart.sh

#!/bin/bash
#auth xilh 
#time 2017-07-26
#Auto deploy Tomcat for jenkins perf
#params:
#       $1: port
if [ -z $1 ]
then
        echo "port may not be null"
        exit 1
fi
export JAVA_HOME=/home/xiluhua/application/java/jdk1.8.0_131
TOMCAT_PID=`/usr/sbin/lsof -i :$1|grep -v PID|awk '{ print $2 }'`
echo $1
echo $TOMCAT_PID
TOMCAT_DIR=/home/xiluhua/application/tomcat/$1/apache-tomcat-8.0.45/
cd $TOMCAT_DIR;cd webapps/
rm 02Helloworld*
wget -c http://192.168.178.133:8080/docs/02Helloworld-0.0.1-SNAPSHOT.war
cd $TOMCAT_DIR;cd work/
rm * -rf;
kill -9 $TOMCAT_PID
cd $TOMCAT_DIR;cd bin/
sh catalina.sh start
 
exit 0

可能需要主动解压缩 war 包

/usr/java/jdk1.8.0_131/bin/jar  -xvf  $FILES

 

posted @ 2017-08-02 22:57  xiluhua  阅读(201)  评论(0编辑  收藏  举报