Skip to content

Commit e9f2263

Browse files
committed
feat: Improvements
1 parent 45fcbf1 commit e9f2263

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
lines changed

scripts/download-oas.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fi
3333
# Move oas to root level
3434
mkdir ${ROOT_DIR}/oas
3535
cd ${work_dir}
36-
git clone ${OAS_REPO}
36+
git clone ${OAS_REPO} --quiet
3737

3838
for service_dir in ${work_dir}/${OAS_REPO_NAME}/services/*; do
3939
max_version_dir=""

scripts/generate-sdk/generate-sdk.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ fi
7474
# Generate SDK for the specified language
7575
case "${LANGUAGE}" in
7676
go)
77-
echo -e "\nGenerating the Go SDK...\n"
77+
echo -e "\n>> Generating the Go SDK..."
7878

7979
source ${LANGUAGE_GENERATORS_FOLDER_PATH}/${LANGUAGE}.sh
8080
# Usage: generate_go_sdk GENERATOR_PATH GIT_HOST GIT_USER_ID [GIT_REPO_ID] [SDK_REPO_URL]
8181
generate_go_sdk ${jar_path} ${GIT_HOST} ${GIT_USER_ID} ${GIT_REPO_ID} ${SDK_REPO_URL}
8282
;;
8383
python)
84-
echo -e "\nGenerating the Python SDK...\n"
84+
echo -e "\n>> Generating the Python SDK..."
8585

8686
source ${LANGUAGE_GENERATORS_FOLDER_PATH}/${LANGUAGE}.sh
8787
# Usage: generate_python_sdk GENERATOR_PATH GIT_HOST GIT_USER_ID [GIT_REPO_ID] [SDK_REPO_URL]
8888
generate_python_sdk ${jar_path} ${GIT_HOST} ${GIT_USER_ID} ${GIT_REPO_ID} ${SDK_REPO_URL}
8989
;;
9090
*)
91-
echo "SDK language not supported."
91+
echo "! SDK language not supported."
9292
exit 1
9393
;;
9494
esac

scripts/generate-sdk/languages/go.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,5 +215,4 @@ generate_go_sdk() {
215215
cd ${SDK_REPO_LOCAL_PATH}
216216
goimports -w ${SERVICES_FOLDER}/
217217
make sync-tidy
218-
219218
}

scripts/sdk-create-pr.sh

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ BRANCH_PREFIX=$1
1111
COMMIT_INFO=$2
1212

1313
if [ $# -lt 2 ]; then
14-
echo "Not enough arguments supplied. Required: 'branch-prefix' 'commit-info'"
14+
echo "! Not enough arguments supplied. Required: 'branch-prefix' 'commit-info'"
1515
exit 1
1616
fi
1717

1818
if type -p go >/dev/null; then
1919
:
2020
else
21-
echo "Go not installed, unable to proceed."
21+
echo "! Go not installed, unable to proceed."
2222
exit 1
2323
fi
2424

2525
if [ ! -d ${SDK_REPO_LOCAL_PATH} ]; then
26-
echo "sdk to commit not found in root. Please run make generate-sdk"
26+
echo "! SDK to commit not found in root. Please run make generate-sdk"
2727
exit 1
2828
fi
2929

@@ -48,7 +48,7 @@ if [[ ! ${work_dir} || -d {work_dir} ]]; then
4848
fi
4949

5050
# Delete temp directory on exit
51-
trap "rm -rf ${work_dir}" EXIT
51+
# trap "rm -rf ${work_dir}" EXIT
5252

5353
mkdir ${work_dir}/git_repo # Where the git repo will be created
5454
mkdir ${work_dir}/sdk_backup # Backup of the SDK to check for new modules
@@ -60,7 +60,7 @@ rm -rf ${work_dir}/sdk_to_push/.git
6060

6161
# Initialize git repo
6262
cd ${work_dir}/git_repo
63-
git clone ${REPO_URL_SSH} ./
63+
git clone ${REPO_URL_SSH} ./ --quiet
6464
git config user.name "${COMMIT_NAME}"
6565
git config user.email "${COMMIT_EMAIL}"
6666

@@ -80,6 +80,25 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
8080
service_changes=$(git status --porcelain "services/$service")
8181

8282
if [[ -n "$service_changes" ]]; then
83+
echo -e "\n>> Detected changes in $service service"
84+
85+
# If lint or test fails for a service, we skip it and continue to the next one
86+
echo "## git rev-parse --show-toplevel: $(git rev-parse --show-toplevel)"
87+
echo " ## ls -la git rev-parse --show-toplevel: $(ls -la $(git rev-parse --show-toplevel))"
88+
echo " ## cat go.work: $(cat $(git rev-parse --show-toplevel)/go.work)"
89+
echo "## pwd: $(pwd)"
90+
echo " ## ls -la pwd: $(ls -la)"
91+
echo " ## cat go.work: cat $(pwd)/go.work"
92+
93+
make lint skip-non-generated-files=true service=$service || {
94+
echo "! Linting failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
95+
continue
96+
}
97+
make test skip-non-generated-files=true service=$service || {
98+
echo "! Testing failed for $service. THE UPDATE OF THIS SERVICE WILL BE SKIPPED."
99+
continue
100+
}
101+
83102
if [[ "$BRANCH_PREFIX" != "main" ]]; then
84103
git switch main # This is needed to create a new branch for the service without including the previously committed files
85104
branch="$BRANCH_PREFIX/$service"
@@ -99,25 +118,13 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
99118

100119
if [[ "$branch" != "main" ]]; then
101120
echo ">> Creating PR for $service"
102-
103121
git commit -m "Generate $service"
104122
git push origin "$branch"
105123
gh pr create --title "Generator: Update SDK /services/$service" --body "$COMMIT_INFO" --head "$branch" --base "main"
106124
else
107125
echo ">> Pushing changes for $service service..."
108-
109-
# If lint or test fails for a service, we skip it and continue to the next one
110-
make lint skip-non-generated-files=true service=$service || {
111-
echo "! Linting failed for $service"
112-
continue
113-
}
114-
make test skip-non-generated-files=true service=$service || {
115-
echo "! Testing failed for $service"
116-
continue
117-
}
118-
119-
git commit -m "Generate $service: $COMMIT_INFO"
120-
git push origin "$branch"
126+
# git commit -m "Generate $service: $COMMIT_INFO"
127+
# git push origin "$branch"
121128
fi
122129
fi
123130
done

0 commit comments

Comments
 (0)