1.在jenkins上添加出版本的服务器节点CI-Build-Server
1)和”篇一“是一样的,需要把jenkins服务器的公钥放到CI-Build-Server服务器
2)由于需要在CI-Build-Server服务器用账号拉代码编译出版本,所以需要一个hg账号;且因为是通过ssh拉代码,所以需要把CI-Build-Server服务器的公钥放到代码服务器平台,制造公钥和传递公钥的方法篇一已经介绍过,不做赘述。
2.添加名为HD_RX_MS的job并指定运行的服务器,命名为HD_RX_MS是因为要和代码服务器文件夹名保持一致
3.运行出版本的脚本
4.出版本后触发测试基本功能的job,后续见篇3
补代码(前提是版本编译的路径下已经编译过一次版本,每出5个临时版本即带p版本后出1个正式版本):
#!/bin/bash
echo “before build,get version info”
count=cat ~/.image_count.txt
echo “before build count is $count”
cd /home/buildmanager/workspace/HD_RX_MS/Project/images
for file in find . -name "3FE*"
do
echo
f
i
l
e
d
o
n
e
i
m
a
g
e
p
a
t
h
=
file done image_path=
filedoneimagepath=file
echo “image_path is $image_path”
image=echo $image_path | sed -e 's/^[./]*//g'
echo “image is $image”
rm -rf $image
soft_num=echo $image | sed -e 's/^[3FE49334AFG]*//g'
echo “soft_num is $soft_num”
if [
c
o
u
n
t
−
l
t
6
]
;
t
h
e
n
s
o
f
t
n
a
m
e
=
"
A
F
G
0
count -lt 6 ];then softname="AFG0
count−lt6];thensoftname="AFG0soft_num"
else
soft_num=$(expr $soft_num + 1)
if [ $soft_num -lt 100 ];then
soft_num="0$soft_num"
fi
softname="AFG0$soft_num"
fi
echo “softname is $softname”
echo “build running”
cd /home/buildmanager/workspace/HD_RX_MS
hg revert --all
hg purge --all
hg clean --all
hg pull & hg update
echo “after build,upload image”
count=$(expr
c
o
u
n
t
+
1
)
e
c
h
o
"
count + 1) echo "
count+1)echo"count" > ~/.image_count.txt
cd /home/buildmanager/workspace/HD_RX_MS/build/u490pp
make SOFTWAREVERSION=$softname && cd /home/buildmanager/workspace/HD_RX_MS/Project/images
date=date
echo “date is $date”
date_num=echo $date | tr -cd "[0-9]"
year_temp=echo $date | cut -d " " -f 1
year=echo $year_temp | tr -cd "[0-9]"
year_last=echo ${year:2:2}
month_temp=echo $date | cut -d " " -f 2
month=echo $month_temp | tr -cd "[0-9]"
month=$(expr $month + 0)
if [ $month -lt 4 ];then
release_path=01
elif [ $month -gt 3 ] && [ $month -lt 7 ];then
release_path=02
elif [ $month -gt 6 ] && [ $month -lt 10 ];then
release_path=03
elif [ $month -gt 9 ] && [ $month -lt 13 ];then
release_path=04
fi
if [ KaTeX parse error: Expected group after '_' at position 35: … image_tar="FBD_̲{year_last}
r
e
l
e
a
s
e
p
a
t
h
.
{release_path}.
releasepath.{soft_num}.p${count}.tar"
echo “image_tar is KaTeX parse error: Expected group after '_' at position 29: …clinux_tar="FBD_̲{year_last}
r
e
l
e
a
s
e
p
a
t
h
.
{release_path}.
releasepath.{soft_num}.p
c
o
u
n
t
.
t
c
l
i
n
u
x
.
t
a
r
"
e
l
s
e
c
o
u
n
t
=
0
e
c
h
o
"
{count}.tclinux.tar" else count=0 echo "
count.tclinux.tar"elsecount=0echo"count” > ~/.image_count.txt
image_tar=“FBD_
y
e
a
r
l
a
s
t
{year_last}
yearlast{release_path}.${soft_num}.tar”
echo “image_tar is KaTeX parse error: Expected group after '_' at position 29: …clinux_tar="FBD_̲{year_last}
r
e
l
e
a
s
e
p
a
t
h
.
{release_path}.
releasepath.{soft_num}.tclinux.tar”
fi
tar -cf $image_tar $image
tar -cf $tclinux_tar tclinux*
sshpass -p ‘fx20210114’ scp
i
m
a
g
e
t
a
r
r
o
o
t
@
192.168.100.42
:
/
h
o
m
e
/
I
M
A
G
E
S
/
F
B
D
R
image_tar root@192.168.100.42:/home/IMAGES/FBDR
imagetarroot@192.168.100.42:/home/IMAGES/FBDR{year_last}${release_path}
sshpass -p ‘fx20210114’ scp
t
c
l
i
n
u
x
t
a
r
r
o
o
t
@
192.168.100.42
:
/
h
o
m
e
/
I
M
A
G
E
S
/
F
B
D
R
tclinux_tar root@192.168.100.42:/home/IMAGES/FBDR
tclinuxtarroot@192.168.100.42:/home/IMAGES/FBDR{year_last}${release_path}
rm -rf $image_tar
rm -rf $tclinux_tar
echo “after build count is $count”
出版本会把版本传到代码服务器