mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 10:00:06 +00:00
Fix: Refactors shell to have double quotes format (#3830)
* refactors double quote to prevent globbing and word splitting e2e sh Signed-off-by: afzal442 <afzal442@gmail.com> * refactors e2e_core sh Signed-off-by: afzal442 <afzal442@gmail.com> * refactors cleanup sh Signed-off-by: afzal442 <afzal442@gmail.com> * refactors header-chk sh Signed-off-by: afzal442 <afzal442@gmail.com> * refactors installdef sh Signed-off-by: afzal442 <afzal442@gmail.com>
This commit is contained in:
@@ -3,15 +3,15 @@
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR=$(dirname "$0")
|
||||
pushd $SCRIPT_DIR
|
||||
pushd "$SCRIPT_DIR"
|
||||
|
||||
TEMPLATE_DIR="../../config/crd/base"
|
||||
|
||||
echo "clean up unused fields of CRDs"
|
||||
|
||||
for filename in `ls $TEMPLATE_DIR`; do
|
||||
for filename in `ls "$TEMPLATE_DIR"`; do
|
||||
|
||||
sed -i.bak '/creationTimestamp: null/d' ${TEMPLATE_DIR}/$filename
|
||||
sed -i.bak '/creationTimestamp: null/d' "${TEMPLATE_DIR}/$filename"
|
||||
|
||||
done
|
||||
|
||||
@@ -19,9 +19,9 @@ rm ${TEMPLATE_DIR}/*.bak
|
||||
|
||||
TEMPLATE_DIR="../../legacy/charts/vela-core-legacy/crds"
|
||||
|
||||
for filename in `ls $TEMPLATE_DIR`; do
|
||||
for filename in `ls "$TEMPLATE_DIR"`; do
|
||||
|
||||
sed -i.bak '/creationTimestamp: null/d' ${TEMPLATE_DIR}/$filename
|
||||
sed -i.bak '/creationTimestamp: null/d' "${TEMPLATE_DIR}/$filename"
|
||||
|
||||
done
|
||||
|
||||
|
||||
@@ -8,16 +8,16 @@ echo "${OAM_DOCKER_DIR}"
|
||||
docker exec kind-control-plane crictl exec "${OAM_CONTAINER_ID}" kill -2 1
|
||||
|
||||
file=$OAM_DOCKER_DIR/e2e-profile.out
|
||||
echo $file
|
||||
echo "$file"
|
||||
n=1
|
||||
while [ $n -le 60 ];do
|
||||
if_exist=$(docker exec kind-control-plane sh -c "test -f $file && echo 'ok'")
|
||||
echo $if_exist
|
||||
echo "$if_exist"
|
||||
if [ -n "$if_exist" ];then
|
||||
docker exec kind-control-plane cat $file > /tmp/oam-e2e-profile.out
|
||||
docker exec kind-control-plane cat "$file" > /tmp/oam-e2e-profile.out
|
||||
break
|
||||
fi
|
||||
echo file not generated yet
|
||||
n=$(expr $n + 1)
|
||||
n="$(expr $n + 1)"
|
||||
sleep 1
|
||||
done
|
||||
@@ -6,16 +6,16 @@ echo "${DOCKER_DIR}"
|
||||
docker exec kind-control-plane crictl exec "${CONTAINER_ID}" kill -2 1
|
||||
|
||||
file=$DOCKER_DIR/e2e-profile.out
|
||||
echo $file
|
||||
echo "$file"
|
||||
n=1
|
||||
while [ $n -le 60 ];do
|
||||
if_exist=$(docker exec kind-control-plane sh -c "test -f $file && echo 'ok'")
|
||||
echo $if_exist
|
||||
echo "$if_exist"
|
||||
if [ -n "$if_exist" ];then
|
||||
docker exec kind-control-plane cat $file > /tmp/e2e-profile.out
|
||||
docker exec kind-control-plane cat "$file" > /tmp/e2e-profile.out
|
||||
break
|
||||
fi
|
||||
echo file not generated yet
|
||||
n=$(expr $n + 1)
|
||||
n="$(expr $n + 1)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
@@ -23,8 +23,8 @@ for file in $(git ls-files | grep "\.go$" | grep -v vendor/); do
|
||||
fi
|
||||
if [ $ERR == true ]; then
|
||||
if [[ $# -gt 0 && $1 =~ [[:upper:]fix] ]]; then
|
||||
cat ../boilerplate.go.txt ${file} > ${file}.new
|
||||
mv ${file}.new ${file}
|
||||
cat ../boilerplate.go.txt "${file}" > "${file}".new
|
||||
mv "${file}".new "${file}"
|
||||
echo "$(tput -T xterm setaf 3)FIXING$(tput -T xterm sgr0)"
|
||||
ERR=false
|
||||
else
|
||||
|
||||
@@ -11,15 +11,15 @@ function check_install() {
|
||||
kubectl create namespace vela-system
|
||||
fi
|
||||
echo "applying definitions ..."
|
||||
cd $DEF_PATH
|
||||
cd "$DEF_PATH"
|
||||
|
||||
for file in *.yaml ;
|
||||
do
|
||||
echo "Info: changing "$DEF_PATH"/"$file
|
||||
sed -i.bak "s#namespace: {{ include \"systemDefinitionNamespace\" . }}#namespace: vela-system#g" $file
|
||||
kubectl apply -f $file
|
||||
rm $file
|
||||
mv $file".bak" $file
|
||||
echo "Info: changing "$DEF_PATH"/""$file"
|
||||
sed -i.bak "s#namespace: {{ include \"systemDefinitionNamespace\" . }}#namespace: vela-system#g" "$file"
|
||||
kubectl apply -f "$file"
|
||||
rm "$file"
|
||||
mv "$file"".bak" "$file"
|
||||
done
|
||||
|
||||
cd -
|
||||
|
||||
Reference in New Issue
Block a user