shell脚本git批量拉取代码

网友投稿 449 2022-10-07

shell脚本git批量拉取代码

前言:

此代码只可做参照,因每个项目不同,拉取代码的方式不同此项目有多个服务微服务架构:pay-parent-pom pay-soa-base pay-spi 等 因此更新每个服务需要将服务git pull,很费时间,所以写了此shell脚本,一键更新所有的服务至最新。思想:遍历所有的dirs服务列表,一个个命令更新执行。

代码如下(1):

dirs=(pay-parent-pom pay-soa-base pay-spi pay-soa-spi pay-soa-framework soa-proxy-client pay-soa-gateway pay-soa-channel pay-soa-wallet basic-soa-pay pay-notify-web pay-notify-router pay-soa-risk pay-job pay-cron-job pay-risk-job pay-kms-spi pay-kms-client pay-soa-card)

for i in "${dirs[@]}";

do

#mkdir $i

#cd $i

echo Pull pwd start build.............................

git clone checkout master

git pull -v

#cd ..

done

代码如下(2) :

set timeout 10 set host "10.199.1.11" set username "lishilong" set password "password "

dirs=(pay-parent-pom pay-soa-base pay-spi pay-soa-spi pay-soa-framework soa-proxy-client pay-soa-gateway pay-soa-channel pay-soa-wallet basic-soa-pay pay-notify-web pay-notify-router pay-soa-risk pay-job pay-cron-job pay-risk-job pay-kms-spi pay-kms-client pay-soa-card)

for i in "${dirs[@]}"; do mkdir $i cd $i echo Pull ​​​pwd start build..........................​​​... set host "1.1.41.109" set username "jiangjiahao" set password "password "

dirs=(pay-parent-pom pay-soa-base pay-spi pay-soa-spi pay-soa-framework soa-proxy-client pay-soa-gateway pay-soa-channel pay-soa-wallet basic-soa-pay pay-notify-web pay-notify-router pay-soa-risk pay-job pay-cron-job pay-risk-job pay-kms-spi pay-kms-client pay-soa-card)

for i in "${dirs[@]}"; do mkdir $i cd $i echo Pull ​​​pwd start build..........................​​...

git checkout master && k8s-master

expect "Username for '{send "$username\r"} expect "Password for '{send "$password\r"} interact git pull -v cd .. done

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:SpringBoot整合Vue实现微信扫码支付以及微信退款功能详解
下一篇:LVS-DR模式+Keepalived
相关文章

 发表评论

暂时没有评论,来抢沙发吧~