-
Notifications
You must be signed in to change notification settings - Fork 5
feat(control): enable kubectl completion #492
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
base: master
Are you sure you want to change the base?
Conversation
f3a9153
to
addecef
Compare
|
||
versionStr := strings.TrimPrefix(string(Version(fab)), "v") | ||
|
||
tempExtractDir := fmt.Sprintf("/tmp/bash-completion-%s", versionStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temp dir should be created using tmp, err := os.MkdirTemp("", "some")
followed by deferred cleanup defer os.RemoveAll(tmp)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we embed the script it doesn't apply anymore
|
||
listCmd := exec.CommandContext(ctx, "tar", "-tvf", tarballPath) | ||
listCmd.Dir = workDir | ||
listCmd.Stdout = logutil.NewSink(ctx, slog.Debug, "tarball contents: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logutil's sink should always be used in a func with out ctx with deferred cancel as it spawns a background goroutine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was for debug purposes. The advice is very welcome, though. Thanks
@@ -208,6 +209,15 @@ func (b *ControlInstallBuilder) Build(ctx context.Context) error { | |||
return fmt.Errorf("downloading cert-manager: %w", err) | |||
} | |||
|
|||
slog.Info("Adding bash-completion to installer", "control", b.Control.Name) | |||
if err := b.Downloader.FromORAS(ctx, installDir, bashcompletion.BashCompletionRef, bashcompletion.Version(b.Fab), []artificer.ORASFile{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are we getting contents of that file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed to zot manually for testing purposes. I wanted to discuss next steps when I make it work. I made a mistake with the artifact itself
998278e
to
4f4a937
Compare
@@ -0,0 +1,3981 @@ | |||
# -*- shell-script -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scop/bash-completion seems to be under GPL-2.0 license, so we can't include it in our repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good catch. Removed it. We would need this artifact uploaded with tag v2.16.0
, then:
eg: oras push REG:PORT/githedgehog/bash-completion:v2.16.0 --artifact-type text/plain bash_completion
add bash completion as external component control node completes kubectl commands and parameters via bash completion kubectl fabric will be autocompleted also when it is supported Signed-off-by: Pau Capdevila <pau@githedgehog.com>
4f4a937
to
61bed38
Compare
@pau-hedgehog that seems to become stale, should we close it for now? thx |
I think this one is quite convenient for usability. But I was blocked as I cannot push to
If you don't think this adds value now, you can close it |
No description provided.