fix(ci): update the Buf CI to push tags to the Buf Schema Registry#280
fix(ci): update the Buf CI to push tags to the Buf Schema Registry#280rach-id merged 5 commits intocelestiaorg:mainfrom
Conversation
|
Warning Rate limit exceeded@rach-id has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 35 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe changes involve the removal of an existing GitHub Actions workflow file and the introduction of two new workflow files along with a shell script. The old workflow defined in Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #280 +/- ##
=======================================
Coverage 68.01% 68.01%
=======================================
Files 6 6
Lines 1138 1138
=======================================
Hits 774 774
Misses 337 337
Partials 27 27 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (4)
scripts/buf-download.sh (2)
5-6: Consider improving version management.While setting the
BUF_VERSIONvariable is good for consistency, consider the following improvements:
- Add a comment explaining why this specific version was chosen.
- Consider making the version configurable, either through an environment variable or a command-line argument, to make it easier to update in the future.
Example:
# Set BUF_VERSION to 1.44.0 or use the value from the BUF_VERSION environment variable if set BUF_VERSION=${BUF_VERSION:-1.44.0}
7-10: Approve download logic with suggestions for improvement.The download logic is well-constructed:
- Uses
curlwith appropriate options.- Dynamically constructs the URL based on the OS and architecture.
- Correctly sets the executable permission.
However, consider adding error handling:
- Check if the download was successful.
- Verify the integrity of the downloaded binary (e.g., using checksums).
- Add error messages for failed downloads or permission changes.
Example improvement:
if ! curl -sSL \ "https://github.com/bufbuild/buf/releases/download/v$BUF_VERSION/buf-$(uname -s)-$(uname -m)" \ -o "./buf"; then echo "Failed to download buf binary" >&2 exit 1 fi if ! chmod +x "./buf"; then echo "Failed to set executable permission on buf binary" >&2 exit 1 fi if ! ./buf --version; then echo "Failed to verify buf binary" >&2 exit 1 fi.github/workflows/buf-ci.yml (1)
15-15: Consider specifying a version for the Buf setup action.While using the latest version is often desirable, it's generally a good practice to pin action versions to ensure reproducibility and prevent unexpected changes. Consider updating the Buf setup action to use a specific version:
- uses: bufbuild/buf-setup-action@v1 + uses: bufbuild/buf-setup-action@v1.27.1Replace
1.27.1with the latest stable version available at the time of implementation..github/workflows/buf-release.yml (1)
7-14: LGTM: Job setup and initial steps are well-configured.The job setup and initial steps are well-configured:
- Using the latest Ubuntu ensures up-to-date dependencies.
- The checkout action is at the latest major version (v4).
- The Buf setup action uses a specific version (1.44.0), which is good for reproducibility.
Consider setting up a process to periodically review and update the Buf version (currently 1.44.0) to ensure you're using the latest features and security updates.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (4)
- .github/workflows/buf-ci.yaml (0 hunks)
- .github/workflows/buf-ci.yml (1 hunks)
- .github/workflows/buf-release.yml (1 hunks)
- scripts/buf-download.sh (1 hunks)
💤 Files with no reviewable changes (1)
- .github/workflows/buf-ci.yaml
🧰 Additional context used
🪛 yamllint
.github/workflows/buf-release.yml
[error] 26-26: trailing spaces
(trailing-spaces)
🔇 Additional comments (8)
scripts/buf-download.sh (1)
1-4: LGTM: Clear shebang and descriptive comment.The script starts with the correct shebang for a bash script, and the comment clearly explains the purpose of the script.
.github/workflows/buf-ci.yml (5)
1-6: LGTM: Workflow name and trigger events are well-defined.The workflow name 'buf-ci' is concise and descriptive. The trigger events (push to main and pull requests) are appropriate for a continuous integration workflow.
7-9: LGTM: Permissions are appropriately set.The permissions follow the principle of least privilege, granting only the necessary access: read for contents and write for pull requests. This is a good security practice.
10-12: LGTM: Job definition is clear and uses an appropriate runner.The job is well-named as 'buf' and uses the latest Ubuntu runner, which is a good practice for ensuring up-to-date dependencies.
13-22: Clarify the implementation of pushing changes to the Buf Schema Registry.The PR objectives mention implementing a test for pushing a new tag to the Buf Schema Registry (BSR). However, the current workflow doesn't include a step for this. Could you clarify if this functionality is implemented elsewhere or if it should be added to this workflow?
#!/bin/bash # Description: Check for Buf push commands in other workflow files # Test: Search for Buf push commands in other workflow files echo "Searching for Buf push commands in other workflow files:" grep -R "buf push" .github/workflows/*.y*ml # Test: Check for a separate release workflow echo "Checking for a separate release workflow:" ls .github/workflows/*release*.y*mlIf you'd like assistance in adding a step to push changes to the Buf Schema Registry, please let me know, and I can provide a code snippet for that.
18-22: Verify the 'pb' directory usage.The workflow uses the 'pb' directory as input for both the breaking change check and lint actions. Please confirm that this directory contains all the necessary protobuf files for your project.
✅ Verification successful
Further verification needed. Please run the following scripts to confirm the 'pb' directory and its
.protofiles:
'pb' directory is present and contains the required
.protofiles.
- No further action needed regarding the 'pb' directory usage in the workflow.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the existence and contents of the 'pb' directory # Test: Check if the 'pb' directory exists and list its contents if [ -d "pb" ]; then echo "The 'pb' directory exists. Contents:" ls -R pb else echo "Error: The 'pb' directory does not exist." exit 1 fi # Test: Check for .proto files in the 'pb' directory proto_files=$(find pb -name "*.proto") if [ -n "$proto_files" ]; then echo "Found .proto files in the 'pb' directory:" echo "$proto_files" else echo "Warning: No .proto files found in the 'pb' directory." fiLength of output: 664
Script:
#!/bin/bash # Description: Verify the existence and contents of the 'pb' directory # Check if the 'pb' directory exists if [ -d "pb" ]; then echo "The 'pb' directory exists." # List contents of the 'pb' directory echo "Contents of 'pb' directory:" ls -R pb else echo "Error: The 'pb' directory does not exist." exit 1 fi # Check for .proto files in the 'pb' directory echo "Searching for .proto files in 'pb' directory..." proto_files=$(find pb -type f -name "*.proto") if [ -n "$proto_files" ]; then echo "Found .proto files:" echo "$proto_files" else echo "Warning: No .proto files found in the 'pb' directory." fiLength of output: 483
.github/workflows/buf-release.yml (2)
1-5: LGTM: Workflow name and trigger are well-defined.The workflow name "buf-release" is descriptive and the trigger on tags matching "v*" is appropriate for a release workflow. This ensures that the workflow runs when version tags are pushed, which is typically when releases are made.
15-18: LGTM: Buf push action is correctly configured.The Buf push action is well-configured:
- It uses the official
bufbuild/buf-push-action@v1.- The Buf token is correctly stored and accessed as a GitHub secret, which is a good security practice.
- The comment above the action provides clarity on its purpose.
|
failing go build CI is because I am creating the PR from a fork and codecov doesn't have permissions to check it. the failing linter is fixed in #278 the markdown contains some dead links but there is an issue to fix them |
This PR fixes the push of a new tag to BSR.
Tested in my fork in here: https://buf.build/chamirachid/nmt/labels
Summary by CodeRabbit
New Features
bufbinary.Bug Fixes
buf-ciworkflow to streamline processes.