摘要:最近在搞,把自己寫的集成腳本分享出來給大家。里面很多路徑或者名稱是我自己的,自行替換掉。
最近在搞jenkins + docker CI,把自己寫的集成腳本分享出來給大家。里面很多路徑或者名稱是我自己的,自行替換掉。
#!/bin/sh # Jenkins Build Shell Script # Author zdzhou@iflytek.com set -e # Get running docker image name cid=`docker ps | grep "isearch" | awk {"print $1"}` echo $cid # If exists running isearch docker image, stop and remove it if [ -n "$cid" ] then echo Get the running docker container id of isearch: $cid docker stop $cid docker rm $cid else echo There is no running isearch docker container fi # Copy target war to dest directory cd ${JENKINS_HOME}/workspace/${JOB_NAME}/itv-web/ echo Current work directory `pwd` cp target/itv-web.war /usr/local/tomcat/webapps echo Run docker image docker run -d -p 8080:8080 -v /usr/local/isearch:/usr/local/isearch -v /usr/local/tomcat/webapps:/usr/local/tomcat/webapps --name=isearch${SVN_REVISION} isearch # Wait for starting docker container totalWait=0 until [ "`/usr/bin/docker inspect -f {{.State.Running}} isearch${SVN_REVISION}`" == "true" ] do totalWait=$[ $totalWait + 2 ] if (( $totalWait > 10 )) then echo "Start docker container timeout" exit 1 fi echo "Waiting for starting docker container: $totalWait minute" sleep 2m done echo "Start docker container success " # Wait for starting tomcat totalWait=0 until [ "`curl -o /dev/null --silent -m 10 --retry 1 --connect-timeout 10 --head --write-out "%{http_code} " http://127.0.0.1:8080/itv-web/v3/videosearch/?appid=aginomoto`" = "200" ] do totalWait=$[ $totalWait + 3 ] if (($totalWait > 36 )) then echo "Start tomcat timeout" exit 1 fi echo "Wait for starting tomcat: "$totalWait" minute" sleep 3m done echo "Start tomcat service success" # Run automatic function test script echo "Start automatic function test" export LOG_HOME=${WORKSPACE}/test.log.d/${BUILD_NUMBER} cd /data/jenkins_home/test.framework.d exec ./automatic_test.sh
原文鏈接http://segmentfault.com/a/1190000004297705
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/26490.html
摘要:集群環境的部署方式使用集群管理工具通過版本新增文件實現滾動升級容器等同于應用的部署 1. 思路&流程 Jenkins集成Docker鏡像實現自動發布與Jenkins發布mavne項目思路一樣總體流程 為:Jenkins 拉去遠端源碼 —— gitl實現應用打包 —— jenkins本地把應用程序打包進Docker鏡像 ...
閱讀 2539·2021-10-09 09:44
閱讀 644·2019-08-30 15:44
閱讀 3000·2019-08-29 18:46
閱讀 1139·2019-08-29 18:38
閱讀 561·2019-08-26 10:44
閱讀 2434·2019-08-23 16:07
閱讀 1096·2019-08-23 15:38
閱讀 4100·2019-08-23 14:02