2222 exit 1
2323fi
2424
25- if [ ! -d ${SDK_REPO_LOCAL_PATH} ]; then
25+ if [ ! -d " ${SDK_REPO_LOCAL_PATH} " ]; then
2626 echo " ! SDK to commit not found in root. Please run make generate-sdk"
2727 exit 1
2828fi
4242
4343# Create temp directory to work on
4444work_dir=" $ROOT_DIR /temp"
45- mkdir -p ${work_dir}
45+ mkdir -p " ${work_dir} "
4646if [[ ! ${work_dir} || -d {work_dir} ]]; then
4747 echo " Unable to create temporary directory"
4848 exit 1
5151# Delete temp directory on exit
5252trap " rm -rf ${work_dir} " EXIT
5353
54- mkdir ${work_dir} /git_repo # Where the git repo will be created
55- mkdir ${work_dir} /sdk_backup # Backup of the SDK to check for new modules
56- mkdir ${work_dir} /sdk_to_push # Copy of SDK to push
54+ mkdir " ${work_dir} /git_repo" # Where the git repo will be created
55+ mkdir " ${work_dir} /sdk_backup" # Backup of the SDK to check for new modules
56+ mkdir " ${work_dir} /sdk_to_push" # Copy of SDK to push
5757
5858# Prepare SDK to push
59- cp -a ${SDK_REPO_LOCAL_PATH} /. ${work_dir} /sdk_to_push
60- rm -rf ${work_dir} /sdk_to_push/.git
59+ cp -a " ${SDK_REPO_LOCAL_PATH} /." " ${work_dir} /sdk_to_push"
60+ rm -rf " ${work_dir} /sdk_to_push/.git"
6161
6262# Initialize git repo
63- cd ${work_dir} /git_repo
64- git clone ${REPO_URL_SSH} ./ --quiet
63+ cd " ${work_dir} /git_repo"
64+ git clone " ${REPO_URL_SSH} " ./ --quiet
6565git config user.name " ${COMMIT_NAME} "
6666git config user.email " ${COMMIT_EMAIL} "
6767
68- cp -a . ${work_dir} /sdk_backup
68+ cp -a . " ${work_dir} /sdk_backup"
6969
7070# Create PR for each new SDK module if there are changes
7171for service_path in ${work_dir} /sdk_to_push/services/* ; do
@@ -74,8 +74,8 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
7474 # Replace old SDK with new one
7575 # Removal of pulled data is necessary because the old version may have files
7676 # that were deleted in the new version
77- rm -rf ./services/$service / *
78- cp -a ${work_dir} /sdk_to_push/services/$service /. ./services/$service
77+ rm -rf " ./services/${ service} /* "
78+ cp -a " ${work_dir} /sdk_to_push/services/${ service} /. " " ./services/${ service} "
7979
8080 # Check for changes in the specific folder compared to main
8181 service_changes=$( git status --porcelain " services/$service " )
@@ -91,17 +91,15 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
9191 branch=$BRANCH_PREFIX
9292 fi
9393
94- git add services/${service} /
9594 if [ " ${LANGUAGE} " == " go" ] && [ ! -d " ${work_dir} /sdk_backup/services/${service} /" ]; then # Check if it is a newly added SDK module
9695 # go work use -r adds a use directive to the go.work file for dir, if it exists, and removes the use directory if the argument directory doesn’t exist
9796 # the -r flag examines subdirectories of dir recursively
9897 # this prevents errors if there is more than one new module in the SDK generation
9998 go work use -r .
100- git add go.work
10199 fi
102100
103101 # If lint or test fails for a service, we skip it and continue to the next one
104- make lint skip-non-generated-files=true service=$service || {
102+ make lint skip-non-generated-files=true service=" $service " || {
105103 echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
106104 continue
107105 }
@@ -110,11 +108,16 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
110108 if [ " ${service} " = " iaas" ] || [ " ${service} " = " iaasalpha" ]; then
111109 echo " >> Skipping tests of $service service"
112110 else
113- make test skip-non-generated-files=true service=$service || {
111+ make test skip-non-generated-files=true service=" $service " || {
114112 echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
115113 continue
116114 }
117115 fi
116+
117+ git add " services/${service} /"
118+ if [ " ${LANGUAGE} " == " go" ] && [ ! -d " ${work_dir} /sdk_backup/services/${service} /" ]; then # Check if it is a newly added SDK module
119+ git add go.work
120+ fi
118121
119122 if [[ " $branch " != " main" ]]; then
120123 echo " >> Creating PR for $service "
0 commit comments