@@ -98,36 +98,41 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
9898 go work use -r .
9999 fi
100100
101- # If lint or test fails for a service, we skip it and continue to the next one
102- make lint skip-non-generated-files=true service=" $service " || {
103- echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
104- continue
105- }
106- # Our unit test template fails because it doesn't support fields with validations,
107- # such as the UUID component used by IaaS. We introduce this hardcoded skip until we fix it
108- if [ " ${service} " = " iaas" ] || [ " ${service} " = " iaasalpha" ]; then
109- echo " >> Skipping tests of $service service"
110- else
111- make test skip-non-generated-files=true service=" $service " || {
112- echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
101+ # If the target branch is main, we run the linter and tests in order to have code which can be compiled.
102+ # If the target branch is not main, we skip the linter and tests, because in the create PRs the CI pipeline will check run them as well.
103+ # This prevents unrecognized api changes, because we will see them within the PR itself.
104+ if [[ " $branch " == " main" ]]; then
105+ # If lint or test fails for a service, we skip it and continue to the next one
106+ make lint skip-non-generated-files=true service=" $service " || {
107+ echo " ! Linting failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
113108 continue
114109 }
110+ # Our unit test template fails because it doesn't support fields with validations,
111+ # such as the UUID component used by IaaS. We introduce this hardcoded skip until we fix it
112+ if [ " ${service} " = " iaas" ] || [ " ${service} " = " iaasalpha" ]; then
113+ echo " >> Skipping tests of $service service"
114+ else
115+ make test skip-non-generated-files=true service=" $service " || {
116+ echo " ! Testing failed for $service . THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
117+ continue
118+ }
119+ fi
115120 fi
116-
121+
117122 git add " services/${service} /"
118123 if [ " ${LANGUAGE} " == " go" ] && [ ! -d " ${work_dir} /sdk_backup/services/${service} /" ]; then # Check if it is a newly added SDK module
119124 git add go.work
120125 fi
121126
122127 if [[ " $branch " != " main" ]]; then
123128 echo " >> Creating PR for $service "
124- git commit -m " Generate $service "
125- git push origin " $branch "
126- gh pr create --title " Generator: Update SDK /services/$service " --body " $COMMIT_INFO " --head " $branch " --base " main"
129+ echo " git commit -m \ " Generate $service \" "
130+ echo " git push origin \ "$branch \" "
131+ echo ' gh pr create --title "Generator: Update SDK /services/$service" --body "$COMMIT_INFO" --head "$branch" --base "main"'
127132 else
128133 echo " >> Pushing changes for $service service..."
129- git commit -m " Generate $service : $COMMIT_INFO "
130- git push origin " $branch "
134+ echo ' git commit -m "Generate $service: $COMMIT_INFO"'
135+ echo ' git push origin "$branch"'
131136 fi
132137 fi
133138done
0 commit comments