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

fix(server): add default logs bucket behavior to build #1391

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

nourbalaha
Copy link
Contributor

@nourbalaha nourbalaha commented Feb 5, 2025

Overview

This PR adds default logs bucket behavior to build

Summary by CodeRabbit

  • New Features
    • Enhanced build process logging configuration to improve build stability.
  • Style
    • Updated configuration formatting for better consistency in system parameters.

@nourbalaha nourbalaha self-assigned this Feb 5, 2025
Copy link
Contributor

coderabbitai bot commented Feb 5, 2025

Walkthrough

The changes add a new field, DefaultLogsBucketBehavior, set to "REGIONAL_USER_OWNED_BUCKET", to the Options struct of the Cloud Build object in both the copy and importItems methods. Additionally, the formatting for the DiskSizeGb field has been adjusted for consistency. No modifications were made to error handling or the general control flow of the methods.

Changes

File(s) Change Summary
server/.../taskrunner.go Added DefaultLogsBucketBehavior to the Options struct in both copy and importItems methods; adjusted formatting for DiskSizeGb field.

Possibly related PRs

Suggested reviewers

  • yk-eukarya

Poem

In the code garden, a new field sprouts bright,
DefaultLogsBucketBehavior hopped into view this night.
Formatting aligned like a neat, tidy burrow,
Bugs and errors skip off, leaving no sorrow.
With each line refined, the code sings a tune—
A rabbit’s happy hop under a digital moon.

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the server label Feb 5, 2025
Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for reearth-cms canceled.

Name Link
🔨 Latest commit 13ac13d
🔍 Latest deploy log https://app.netlify.com/sites/reearth-cms/deploys/67a36a0a2f527200083b82d3

@nourbalaha nourbalaha marked this pull request as ready for review February 5, 2025 13:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
server/internal/infrastructure/gcp/taskrunner.go (2)

262-263: Consider extracting common build options.

The changes look good, but I notice identical BuildOptions configuration in both copy() and importItems() functions.

Consider extracting the common BuildOptions into a helper function to reduce duplication:

+func getDefaultBuildOptions() *cloudbuild.BuildOptions {
+    return &cloudbuild.BuildOptions{
+        DiskSizeGb:                defaultDiskSizeGb,
+        DefaultLogsBucketBehavior: "REGIONAL_USER_OWNED_BUCKET",
+    }
+}

 func copy(ctx context.Context, p task.Payload, conf *TaskConfig) error {
     // ...
     build := &cloudbuild.Build{
         // ...
-        Options: &cloudbuild.BuildOptions{
-            DiskSizeGb:                defaultDiskSizeGb,
-            DefaultLogsBucketBehavior: "REGIONAL_USER_OWNED_BUCKET",
-        },
+        Options: getDefaultBuildOptions(),
         // ...
     }
     // ...
 }

 func importItems(ctx context.Context, p task.Payload, conf *TaskConfig) error {
     // ...
     build := &cloudbuild.Build{
         // ...
-        Options: &cloudbuild.BuildOptions{
-            DiskSizeGb:                defaultDiskSizeGb,
-            DefaultLogsBucketBehavior: "REGIONAL_USER_OWNED_BUCKET",
-        },
+        Options: getDefaultBuildOptions(),
         // ...
     }
     // ...
 }

134-137: Consider adding DefaultLogsBucketBehavior to decompressAsset.

For consistency with copy() and importItems(), consider adding DefaultLogsBucketBehavior to the BuildOptions in decompressAsset().

 Options: &cloudbuild.BuildOptions{
     MachineType: machineType,
     DiskSizeGb:  diskSizeGb,
+    DefaultLogsBucketBehavior: "REGIONAL_USER_OWNED_BUCKET",
 },

This would ensure consistent behavior across all Cloud Build operations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between da36e6d and 13ac13d.

📒 Files selected for processing (1)
  • server/internal/infrastructure/gcp/taskrunner.go (2 hunks)
🔇 Additional comments (1)
server/internal/infrastructure/gcp/taskrunner.go (1)

186-187: LGTM! Verify Cloud Build logs bucket behavior.

The addition of DefaultLogsBucketBehavior and the formatting changes look good. Let's verify that "REGIONAL_USER_OWNED_BUCKET" is the correct value for your use case.

✅ Verification successful

🌐 Web query:

What are the valid values for DefaultLogsBucketBehavior in Google Cloud Build?

Length of output: 3247


LGTM! DefaultLogsBucketBehavior is correctly set.

The use of "REGIONAL_USER_OWNED_BUCKET" is valid based on the Cloud Build documentation and related sources, confirming that it is one of the accepted values for DefaultLogsBucketBehavior. No changes are needed.

@nourbalaha nourbalaha merged commit 53e75dc into main Feb 5, 2025
24 checks passed
@nourbalaha nourbalaha deleted the fix-server/add-default-logs-bucket branch February 5, 2025 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants