Skip to content
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

feat(packages/scripts): add script gen-delivery-tiup-script.sh #306

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

wuhuizuo
Copy link
Contributor

usage:
./packages/scripts/gen-delivery-tiup-script.sh true|false

example:
./packages/scripts/gen-delivery-tiup-script.sh hub.pingcap.net/pingcap/tidb/package:v8.1.0-pre_darwin_amd64 false xxx.sh
Signed-off-by: wuhuizuo wuhuizuo@126.com

usage:
  ./packages/scripts/gen-delivery-tiup-script.sh <oci-artifact-url> true|false <save-publish-script>

example:
  ./packages/scripts/gen-delivery-tiup-script.sh hub.pingcap.net/pingcap/tidb/package:v8.1.0-pre_darwin_amd64 false xxx.sh
Signed-off-by: wuhuizuo <wuhuizuo@126.com>
@ti-chi-bot ti-chi-bot bot requested a review from purelind April 19, 2024 12:05
Copy link

ti-chi-bot bot commented Apr 19, 2024

I have already done a preliminary review for you, and I hope to help you do a better job.

Summary:

This pull request adds a new script gen-delivery-tiup-script.sh, which generates a publish script for TiUP packages. It takes a few arguments, including the OCI artifact URL and a flag indicating whether it's a nightly build. The script uses yq and oras to fetch the artifact config and generate the publish script.

Potential problems:

  1. The pull request does not include any test cases, which makes it hard to verify whether the script works as expected. It would be better to include some unit tests or integration tests to ensure the script's correctness.
  2. There are no comments in the code, which makes it hard for other developers to understand what the code does and how it works. Adding some comments would make the code more readable and easier to maintain.

Fixing suggestions:

  1. Add some test cases to verify the correctness of the script. The tests should cover various scenarios, including different types of artifacts, nightly builds, and error cases.
  2. Add some comments to explain the code's logic and how it works. The comments should be clear and concise and should not repeat what the code does. They should focus on explaining why the code does what it does and any assumptions or requirements.
  3. Consider refactoring the code to make it more modular and reusable. For example, the code that fetches the artifact config could be extracted into a separate function that could be used by other scripts. Similarly, the code that generates the publish script could be split into smaller functions that could be tested and reused.

@ti-chi-bot ti-chi-bot bot added the size/M label Apr 19, 2024
@wuhuizuo
Copy link
Contributor Author

I have tested it manually, but comment the tiup publish step, just run the post check steps for the existing tiup packages.

@wuhuizuo wuhuizuo added the lgtm label Apr 19, 2024
@wuhuizuo
Copy link
Contributor Author

/approve

Copy link

ti-chi-bot bot commented Apr 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wuhuizuo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@ti-chi-bot ti-chi-bot bot added the approved label Apr 19, 2024
@ti-chi-bot ti-chi-bot bot merged commit acfd576 into main Apr 19, 2024
2 checks passed
@ti-chi-bot ti-chi-bot bot deleted the feature/add-tiup-delivery-gen-script branch April 19, 2024 12:09
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.

1 participant