-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Download swagger-codegen-cli.jar in gen-sdk.sh #2874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download swagger-codegen-cli.jar in gen-sdk.sh #2874
Conversation
|
Hi @BillyChen1. Thanks for your PR. I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
@@ Coverage Diff @@
## master #2874 +/- ##
==========================================
- Coverage 65.58% 65.50% -0.08%
==========================================
Files 396 396
Lines 22798 22798
==========================================
- Hits 14951 14933 -18
- Misses 6098 6116 +18
Partials 1749 1749
... and 3 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
| echo "Generating OpenAPI specification ..." | ||
| ${GOPATH}/bin/openapi-gen --input-dirs github.com/fluid-cloudnative/fluid/api/v1alpha1 --output-package github.com/fluid-cloudnative/fluid/api/v1alpha1 --go-header-file hack/boilerplate.go.txt | ||
|
|
||
| echo "Downloading codegen jar ..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest improving the flexibility and robustness of the code.
-
Before downloading the swagger-codegen-cli.jar file, check if it already exists locally. If it exists, do not attempt to download it again.
-
If the download fails, add a retry mechanism to avoid failures due to network fluctuations.
The modified code adds more robustness and reliability to the script by checking for the presence of curl, avoiding unnecessary downloads of existing files, and retrying failed downloads.
echo "Downloading codegen jar ..."
if ! command -v curl >/dev/null 2>&1; then
echo "Error: curl command not found." >&2
exit 1
fi
if [ -f "${SWAGGER_CODEGEN_JAR}" ]; then
echo "Using existing ${SWAGGER_CODEGEN_JAR}"
else
for i in {1..3}; do
if curl -fLsS "${SWAGGER_CODEGEN_JAR_URL}" -o "${SWAGGER_CODEGEN_JAR}"; then
break
elif [ "$i" -eq 3 ]; then
echo "Failed to download ${SWAGGER_CODEGEN_JAR} after 3 attempts." >&2
exit 1
else
echo "Failed to download ${SWAGGER_CODEGEN_JAR}, retrying in 10 seconds..." >&2
sleep 10
fi
done
fiThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion and code! I think the curl command should only be checked if swagger-codegen-cli.jar file doesn't exist locally.
| *.so | ||
| *.dylib | ||
| *.jar | ||
| !hack/sdk/swagger-codegen-cli.jar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think no need to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
@BillyChen1 Could you fix the DCO issue? |
Signed-off-by: cqm <whqscqm@outlook.com>
This reverts commit 108648a. Signed-off-by: cqm <whqscqm@outlook.com>
Signed-off-by: cqm <whqscqm@outlook.com>
89301ac to
bd8065a
Compare
|
Kudos, SonarCloud Quality Gate passed! |
ok |
cheyang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cheyang The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test fluid-e2e-nightly |
* Add OpenSSF Scorecard for README.md (#2685) Signed-off-by: fengshunli <1171313930@qq.com> Signed-off-by: tartaglia <2602542817@qq.com> * This pr is to add Apache License to transform_pvc_mounts_test.go (#2842) Signed-off-by: Alian-g <2320341058@qq.com> Signed-off-by: tartaglia <2602542817@qq.com> * Download swagger-codegen-cli.jar in gen-sdk.sh (#2874) * feature: download swagger-codegen-cli.jar in gen-sdk.sh Signed-off-by: cqm <whqscqm@outlook.com> * Revert "feature: download swagger-codegen-cli.jar in gen-sdk.sh" This reverts commit 108648a. Signed-off-by: cqm <whqscqm@outlook.com> * update: adds more robustness and reliability to gen-sdk.sh Signed-off-by: cqm <whqscqm@outlook.com> --------- Signed-off-by: cqm <whqscqm@outlook.com> Signed-off-by: tartaglia <2602542817@qq.com> * change copyright's year (#2849) Signed-off-by: mofumofuecho <2106975800@qq.com> Signed-off-by: tartaglia <2602542817@qq.com> * Delete swagger-codegen-cli.jar, To #46827170 (#2897) Signed-off-by: cheyang <cheyang@163.com> Signed-off-by: tartaglia <2602542817@qq.com> * add Apache License Signed-off-by: tartaglia <2602542817@qq.com> * 1 Signed-off-by: tartaglia <2602542817@qq.com> * add signoff Signed-off-by: tartaglia <2602542817@qq.com> --------- Signed-off-by: fengshunli <1171313930@qq.com> Signed-off-by: tartaglia <2602542817@qq.com> Signed-off-by: Alian-g <2320341058@qq.com> Signed-off-by: cqm <whqscqm@outlook.com> Signed-off-by: mofumofuecho <2106975800@qq.com> Signed-off-by: cheyang <cheyang@163.com> Co-authored-by: fsl <1171313930@qq.com> Co-authored-by: Alian-g <79347453+Alian-g@users.noreply.github.com> Co-authored-by: Twilight <48305952+BillyChen1@users.noreply.github.com> Co-authored-by: mofumofuecho <100556081+mofumofuecho@users.noreply.github.com> Co-authored-by: cheyang <cheyang@163.com>








Ⅰ. Describe what this PR does
Download swagger-codegen-cli.jar in gen-sdk.sh
Ⅱ. Does this pull request fix one issue?
fixes #2837
Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews