example
#! /bin/bash
num=1
OD_name=("https://code.cestc.cn/product-baseline/product-helloword.git" )
for i in ${OD_name[@]};
do
mkdir $num
cd $num
let "num++"
str=$i
echo $str
git clone $str
find -name "Chart.yaml" | xargs sed -i '/apiVersion: v1/ c\apiVersion:v0.0.5'
#c\ 用法,实现匹配的字符串整行替换成new string(apiVersion:v0.0.5)
cd ./*
git init
git checkout -b testing
# git checkout -b init 默认生成*master branch , git checkout -b 首次不是先提交可以直接创建并切换到new branch(testing)
git add .
git commit -a -m "update"
git remote add origin $str
git push origin testing:cec111 --force
#本地branch(testing) 主机branch(cec111)
cd ..
done
这个脚本用于自动化创建目录,克隆指定的Git仓库,并将`Chart.yaml`文件的`apiVersion`更新为`v0.0.5`。它遍历一个URL数组,对每个URL执行初始化Git仓库、创建新分支、添加文件变更、提交和推送操作。

被折叠的 条评论
为什么被折叠?



