Skip to content

Conversation

@BillyChen1
Copy link
Contributor

Ⅰ. 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

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Apr 3, 2023

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #2874 (3543367) into master (d3de533) will decrease coverage by 0.08%.
The diff coverage is n/a.

❗ Current head 3543367 differs from pull request most recent head bd8065a. Consider uploading reports for the commit bd8065a to get more accurate results

@@            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              
Impacted Files Coverage Δ
pkg/ddc/alluxio/cache.go 75.67% <ø> (ø)
pkg/ddc/alluxio/transform_init_users.go 100.00% <ø> (ø)
pkg/ddc/alluxio/transform_ufs.go 100.00% <ø> (ø)
pkg/ddc/alluxio/ufs.go 43.75% <ø> (ø)
pkg/utils/init_user.go 100.00% <ø> (ø)
pkg/utils/resources.go 100.00% <ø> (ø)

... 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 ..."
Copy link
Collaborator

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.

  1. Before downloading the swagger-codegen-cli.jar file, check if it already exists locally. If it exists, do not attempt to download it again.

  2. 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
fi

Copy link
Contributor Author

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
Copy link
Collaborator

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@cheyang
Copy link
Collaborator

cheyang commented Apr 4, 2023

@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>
@BillyChen1 BillyChen1 force-pushed the chenqiming_gen_sdk branch from 89301ac to bd8065a Compare April 4, 2023 16:43
@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 4, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@BillyChen1
Copy link
Contributor Author

@BillyChen1 Could you fix the DCO issue?

ok

Copy link
Collaborator

@cheyang cheyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@fluid-e2e-bot
Copy link

fluid-e2e-bot bot commented Apr 5, 2023

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cheyang
Copy link
Collaborator

cheyang commented Apr 5, 2023

/test fluid-e2e-nightly

@cheyang cheyang merged commit 9fc6a8e into fluid-cloudnative:master Apr 5, 2023
fluid-e2e-bot bot pushed a commit that referenced this pull request Apr 11, 2023
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURES] Download swagger-codegen-cli.jar instead of storing it in hack/sdk/ directory in gen-sdk.sh script

2 participants