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: don't build longhorn-manager twice before packaging #3226

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

derekbit
Copy link
Member

Which issue(s) this PR fixes:

Issue longhorn/longhorn#8744

What this PR does / why we need it:

Special notes for your reviewer:

Additional documentation or context

@derekbit derekbit self-assigned this Oct 19, 2024
Copy link

coderabbitai bot commented Oct 19, 2024

Walkthrough

The changes in the pull request involve modifying a script to update the condition for checking the existence of the longhorn-manager binary. The previous check for ./bin/longhorn-manager has been replaced with checks for both ./bin/longhorn-manager-amd64 and ./bin/longhorn-manager-arm64. If neither binary is found, a message prompts the user to build the binary, followed by a call to the build script. Other parts of the script remain unchanged.

Changes

Files Change Summary
scripts/package Updated binary existence check from ./bin/longhorn-manager to check for ./bin/longhorn-manager-amd64 and ./bin/longhorn-manager-arm64. Added message and build script call if neither exists.

Assessment against linked issues

Objective Addressed Explanation
Improve build time for longhorn-manager (#8744) The change does not address the build time issue directly.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f0feb56 and 06c0e51.

📒 Files selected for processing (1)
  • scripts/package (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/package

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

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.

Copy link

@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

🧹 Outside diff range and nitpick comments (1)
scripts/package (1)

12-14: Approve changes with suggestions for further improvement

The modification addresses the issue of redundant builds by checking for the existence of both amd64 and arm64 binaries before initiating the build process. This change aligns with the PR objectives and should help reduce build times in cases where the binaries are already present.

However, to further optimize the build process and address the concerns raised in issue #8744, consider the following suggestions:

  1. Implement architecture-specific build options to allow building for a single architecture when needed.
  2. Add a flag to force rebuilding even if binaries exist, which could be useful for development and testing.

Example implementation:

ARCH=${ARCH:-"both"}
FORCE_BUILD=${FORCE_BUILD:-false}

build_binary() {
    echo "Building longhorn-manager binary for $1 architecture"
    ARCH=$1 ./scripts/build
}

if [ "$ARCH" = "both" ]; then
    if [ ! -e ./bin/longhorn-manager-amd64 ] || [ ! -e ./bin/longhorn-manager-arm64 ] || [ "$FORCE_BUILD" = true ]; then
        build_binary amd64
        build_binary arm64
    fi
elif [ "$ARCH" = "amd64" ]; then
    if [ ! -e ./bin/longhorn-manager-amd64 ] || [ "$FORCE_BUILD" = true ]; then
        build_binary amd64
    fi
elif [ "$ARCH" = "arm64" ]; then
    if [ ! -e ./bin/longhorn-manager-arm64 ] || [ "$FORCE_BUILD" = true ]; then
        build_binary arm64
    fi
else
    echo "Invalid architecture specified. Use 'amd64', 'arm64', or 'both'."
    exit 1
fi

These changes would provide more flexibility and potentially further reduce build times when working with a single architecture.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 28b5049 and f0feb56.

📒 Files selected for processing (1)
  • scripts/package (1 hunks)
🧰 Additional context used

Longhorn 8744

Signed-off-by: Derek Su <derek.su@suse.com>
@innobead innobead merged commit aad527c into longhorn:master Oct 22, 2024
8 checks passed
@derekbit
Copy link
Member Author

@mergify backport v1.7.x v1.6.x

Copy link

mergify bot commented Oct 22, 2024

backport v1.7.x v1.6.x

✅ Backports have been created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants