Skip to content

Commit 45fcbf1

Browse files
committed
feat: Improve echos in scripts
1 parent 1533607 commit 45fcbf1

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

scripts/download-oas.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fi
2020
# Create temp directory to clone OAS repo
2121
work_dir=$(mktemp -d)
2222
if [[ ! ${work_dir} || -d {work_dir} ]]; then
23-
echo "Unable to create temporary directory"
23+
echo "! Unable to create temporary directory"
2424
exit 1
2525
fi
2626
trap "rm -rf ${work_dir}" EXIT # Delete temp directory on exit
@@ -55,8 +55,8 @@ for service_dir in ${work_dir}/${OAS_REPO_NAME}/services/*; do
5555
if [[ ${version} == *alpha* ]]; then
5656
# To support initial integrations of the IaaS API in an Alpha state, we will temporarily use it to generate an IaaS Alpha SDK module
5757
# This check can be removed once the IaaS API moves all endpoints to Beta
58-
if [[ ${service} == "iaas" ]]; then
59-
mv -f ${dir}/*.json ${ROOT_DIR}/oas/iaasalpha.json
58+
if [[ ${service} == "iaas" ]]; then
59+
mv -f ${dir}/*.json ${ROOT_DIR}/oas/iaasalpha.json
6060
fi
6161
if [[ ${ALLOW_ALPHA} != "true" ]]; then
6262
continue

scripts/generate-sdk/languages/go.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ generate_go_sdk() {
6262
if type -p go >/dev/null; then
6363
:
6464
else
65-
echo "Go not installed, unable to proceed."
65+
echo "! Go not installed, unable to proceed."
6666
exit 1
6767
fi
6868

@@ -80,7 +80,7 @@ generate_go_sdk() {
8080
# Backup of the current state of the SDK services dir (services/)
8181
sdk_services_backup_dir=$(mktemp -d)
8282
if [[ ! ${sdk_services_backup_dir} || -d {sdk_services_backup_dir} ]]; then
83-
echo "Unable to create temporary directory"
83+
echo "! Unable to create temporary directory"
8484
exit 1
8585
fi
8686
cleanup() {
@@ -128,7 +128,7 @@ generate_go_sdk() {
128128
exit 1
129129
fi
130130

131-
echo -e "\nGenerating \"${service}\" service..."
131+
echo -e "\n>> Generating \"${service}\" service..."
132132
cd ${ROOT_DIR}
133133

134134
GO_POST_PROCESS_FILE="gofmt -w" \

scripts/generate-sdk/languages/python.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ generate_python_sdk() {
2424

2525
# Check required parameters
2626
if [[ -z ${GIT_HOST} ]]; then
27-
echo "GIT_HOST not specified."
27+
echo "! GIT_HOST not specified."
2828
exit 1
2929
fi
3030

3131
if [[ -z ${GIT_USER_ID} ]]; then
32-
echo "GIT_USER_ID id not specified."
32+
echo "! GIT_USER_ID id not specified."
3333
exit 1
3434
fi
3535

@@ -46,7 +46,7 @@ generate_python_sdk() {
4646

4747
# Prepare folders
4848
if [[ ! -d $SERVICES_FOLDER ]]; then
49-
mkdir -p "$SERVICES_FOLDER"
49+
mkdir -p "$SERVICES_FOLDER"
5050
fi
5151

5252
# Clone SDK repo
@@ -63,7 +63,7 @@ generate_python_sdk() {
6363
# Backup of the current state of the SDK services dir (services/)
6464
sdk_services_backup_dir=$(mktemp -d)
6565
if [[ ! ${sdk_services_backup_dir} || -d {sdk_services_backup_dir} ]]; then
66-
echo "Unable to create temporary directory"
66+
echo "! Unable to create temporary directory"
6767
exit 1
6868
fi
6969
cleanup() {
@@ -75,7 +75,7 @@ generate_python_sdk() {
7575
trap cleanup EXIT
7676

7777
# Remove old contents of services dir (services/)
78-
rm -rf ${SERVICES_FOLDER}
78+
rm -rf ${SERVICES_FOLDER}
7979

8080
# Generate SDK for each service
8181
for service_json in ${ROOT_DIR}/oas/*.json; do
@@ -89,7 +89,7 @@ generate_python_sdk() {
8989
service=$(echo "${service}" | tr '[:upper:]' '[:lower:]') # convert upper case letters to lower case
9090
service=$(echo "${service}" | tr -d -c '[:alnum:]') # remove non-alphanumeric characters
9191

92-
echo "Generating \"${service}\" service..."
92+
echo ">> Generating \"${service}\" service..."
9393
cd ${ROOT_DIR}
9494

9595
mkdir -p "${SERVICES_FOLDER}/${service}/"
@@ -113,11 +113,11 @@ generate_python_sdk() {
113113
rm -r "${SERVICES_FOLDER}/${service}/.openapi-generator/"
114114
rm "${SERVICES_FOLDER}/${service}/stackit/__init__.py"
115115
rm "${SERVICES_FOLDER}/${service}/.github/workflows/python.yml"
116-
116+
117117
# Create source layout
118118
mkdir "${SERVICES_FOLDER}/${service}/src"
119119
mv "${SERVICES_FOLDER}/${service}/stackit/" "${SERVICES_FOLDER}/${service}/src/"
120-
120+
121121
# If the service has a wait package files, move them inside the service folder
122122
if [ -d ${sdk_services_backup_dir}/${service}/src/wait ]; then
123123
echo "Found ${service} \"wait\" package"
@@ -165,6 +165,6 @@ generate_python_sdk() {
165165
isort .
166166
autoimport --ignore-init-modules .
167167
black .
168-
168+
169169
done
170170
}

scripts/project.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ elif [ "$action" = "tools" ]; then
2727
elif [ "${LANGUAGE}" == "python" ]; then
2828
pip install black==24.8.0 isort~=5.13.2 autoimport~=1.6.1
2929
else
30-
echo "Invalid language: `$LANGUAGE`, please use $0 help for help"
30+
echo "! Invalid language: $($LANGUAGE), please use $0 help for help"
3131
fi
3232
else
33-
echo "Invalid action: '$action', please use $0 help for help"
33+
echo "! Invalid action: '$action', please use $0 help for help"
3434
fi

scripts/sdk-create-pr.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ 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 "Committing changes for $service"
8483
if [[ "$BRANCH_PREFIX" != "main" ]]; then
8584
git switch main # This is needed to create a new branch for the service without including the previously committed files
8685
branch="$BRANCH_PREFIX/$service"
@@ -99,17 +98,21 @@ for service_path in ${work_dir}/sdk_to_push/services/*; do
9998
fi
10099

101100
if [[ "$branch" != "main" ]]; then
101+
echo ">> Creating PR for $service"
102+
102103
git commit -m "Generate $service"
103104
git push origin "$branch"
104105
gh pr create --title "Generator: Update SDK /services/$service" --body "$COMMIT_INFO" --head "$branch" --base "main"
105106
else
107+
echo ">> Pushing changes for $service service..."
108+
106109
# If lint or test fails for a service, we skip it and continue to the next one
107110
make lint skip-non-generated-files=true service=$service || {
108-
echo "Linting failed for service: $service"
111+
echo "! Linting failed for $service"
109112
continue
110113
}
111114
make test skip-non-generated-files=true service=$service || {
112-
echo "Testing failed for service: $service"
115+
echo "! Testing failed for $service"
113116
continue
114117
}
115118

0 commit comments

Comments
 (0)