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 karmadactl path #6137

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix karmadactl path #6137

wants to merge 1 commit into from

Conversation

sivchari
Copy link

What type of PR is this?

/kind bug

What this PR does / why we need it:

GOBIN and GOPATH is configurable, so use which command to fetch PATH of karmadactl.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Signed-off-by: sivchari <shibuuuu5@gmail.com>
@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 19, 2025
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign liangyuanpeng for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@karmada-bot
Copy link
Collaborator

Welcome @sivchari! It looks like this is your first PR to karmada-io/karmada 🎉

@karmada-bot karmada-bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 19, 2025
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.11%. Comparing base (b763c68) to head (6a6e782).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6137   +/-   ##
=======================================
  Coverage   48.10%   48.11%           
=======================================
  Files         668      668           
  Lines       55307    55307           
=======================================
+ Hits        26605    26610    +5     
+ Misses      26967    26963    -4     
+ Partials     1735     1734    -1     
Flag Coverage Δ
unittests 48.11% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@RainbowMango
Copy link
Member

Hi @sivchari Thanks for spotting, but I'm not sure what problem this PR is supposed to solve, Could you please explain it with more details?

@sivchari
Copy link
Author

Hi @RainbowMango

As I said, GOPATH and GOBIN is configurable, then the priority is following when running go install.

  1. If the GOBIN is set, the destination is GOBIN
  2. if the GOBIN isn't set and GOPATH is set, the destination is GOPATH/bin

Thus if GOBIN is set to another location, karmadactl might not be installed to the following location.

GOPATH=$(go env GOPATH | awk -F ':' '{print $1}')
KARMADACTL_BIN="${GOPATH}/bin/karmadactl"

It would be good to use which command to ensure success in any environment.
I feel free that you close this PR if it's unnecessary change.

Thanks!

@RainbowMango
Copy link
Member

Thank you for the explanation, I understand that the current implementation requires GOBIN to remain as its default value ($GOPATH/bin), otherwise the KARMADACTL_BIN will point to a non-existent file.

However, changing to which brings another concern that it requires the GOBIN or GOPATH/bin already included in the PATH environment variable. What do you think of this situation?

@sivchari
Copy link
Author

At now, local-up-karmada.sh needs us to locate the karmadactl in $GOPATH/bin in advance. But, as far as I know, there are some way to install karmadactl and it seems to some way not to install to $GOPATH/bin. So I thought it prefers not to specify $GOPATH/bin.

@RainbowMango
Copy link
Member

@liangyuanpeng Would you like to take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants