jenkins配置(254)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name=ingestdbsvr
version=1.8.5
time=$(date +%Y%m%d%H)
images=${name}:${version}.${time}.${BUILD_NUMBER}
tarname=${images}.tar
pushurl=172.16.128.170:5000/${images}
date +%H:%M:%S
dotnet build -c Release IngestDB.sln
cd IngestDB
dotnet publish -c Release -o ../publish
cd ..
cp BinU/netcoreapp2.1/IngestDB.dll -r publish/
cp BinU/netcoreapp2.1/IngestDBCore.dll -r publish/
cp BinU/netcoreapp2.1/Plugin/IngestMatrixPlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/IngestDeviceInterfacePlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/IngestGlobalInterfacePlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/IngestTaskInterfacePlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/IngestTaskPlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/IngestDevicePlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/MSVNotifyPlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/IngestGlobalPlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/KafKaNotifyPlugin.dll -r publish/Plugin/
cp BinU/netcoreapp2.1/Plugin/UdpNotifyPlugin.dll -r publish/Plugin/
#docker images | grep 'ingestdbsvr' | awk '{print $3}' | xargs docker rmi
chmod -Rf 777 publish
docker build -t $images .
docker tag $images $pushurl
docker push $pushurl
time=$(date +%Y%m%d%H)
appname=ingestdbsvr
version=1.8.5.${time}.${BUILD_NUMBER}
images=${appname}:${version}
Oldtag=`docker images|grep ${appname}|awk '{print $2}'|sort -r|awk 'NR==1{print}'`
container=`docker ps -a|grep ${appname}|awk '{print $1}'|sort -r|awk 'NR==1{print}'`
echo ${appname}-${Oldtag}
echo ${appname}-${version}
echo ${appname}:${container}
docker stop ${container}
docker rm -f ${container}
mkdir /sobeyhive/app/${appname}-${version}
cp -rp /sobeyhive/app/${appname}-notchange/run.sh /sobeyhive/app/${appname}-${version}/
rm -fr /sobeyhive/app/${appname}-${Oldtag}
cd /RunScript/
sh ingestdbsvrsrg.sh ${version}
sleep 5
scp -r /other/sobeyhive/app/ingestmsgsvr-1.6.0/ingestmsgsvr/* root@172.16.128.117:/other/jenkins/workspace/IngestMsgSvr-Integration-SRG1.8.5/publish/
sleep 1
// //