-
Notifications
You must be signed in to change notification settings - Fork 156
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
Implement the tool registry in the piped side #5343
Conversation
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5343 +/- ##
==========================================
+ Coverage 25.29% 25.38% +0.09%
==========================================
Files 444 445 +1
Lines 47656 47772 +116
==========================================
+ Hits 12053 12126 +73
- Misses 34661 34696 +35
- Partials 942 950 +8 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
type toolRegistry struct { | ||
toolsDir string | ||
tmpDir string | ||
group singleflight.Group | ||
} |
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.
Since the tool is not plugin-specific, I think we should have some kind of cache to avoid redundant installation. If the name and version are the same, then we should return the installed path immediately instead of running the script, wdyt?
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 agree. I'll add the cache like below.
pipecd/pkg/app/piped/toolregistry/registry.go
Lines 116 to 121 in 23eddac
r.mu.RLock() | |
_, ok := r.versions[name] | |
r.mu.RUnlock() | |
if ok { | |
return path, false, nil | |
} |
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.
@khanhtc1202
fixed on this commit, thanks
75d7daa
Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
func newToolRegistry(toolsDir, tmpDir string) (*toolRegistry, error) { | ||
tmpDir, err := os.MkdirTemp(tmpDir, "tool-registry") |
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.
[Ask] Is it enough just to create the tmp dir for the tool installation in the newToolRegistry.
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.
Do you mean to call like os.MkdirTemp("", "tool-registry")
and do not pass the tmpDir
as the argument?
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.
Yes, I mean fixing as newToolRegistry(toolsDir string) and call os.MkdirTemp inside it as you said.
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 got your point! That's enough.
I'll change the codes.
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.
fixed on this commit
f9f7bf0
…arameter Signed-off-by: Shinnosuke Sawada-Dazai <[email protected]>
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.
LGTM
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.
Good to go 👍
What this PR does:
as title
Why we need it:
We decided the installation tools should be done on the piped side, not the plugin. ref; #5218
Which issue(s) this PR fixes:
Part of #4980
Does this PR introduce a user-facing change?: No