-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add path filtering to build session client #33859
Conversation
f10c179
to
3add307
Compare
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
builder/dockerfile/builder.go
Outdated
@@ -141,7 +141,7 @@ func (bm *BuildManager) initializeClientSession(ctx context.Context, cancel func | |||
if options.RemoteContext == remotecontext.ClientSessionRemote { | |||
st := time.Now() | |||
csi, err := NewClientSessionSourceIdentifier(ctx, bm.sg, | |||
options.SessionID, []string{"/"}) | |||
options.SessionID) |
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.
nit: this can probably be on a single line now
Signed-off-by: Tonis Tiigi <[email protected]>
Signed-off-by: Tonis Tiigi <[email protected]>
3add307
to
4141d8f
Compare
|
||
// HandleConn handles an incoming raw connection | ||
func (sm *Manager) HandleConn(ctx context.Context, conn net.Conn, opts map[string][]string) error { | ||
sm.mu.Lock() |
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 think sm
's mu
is being locked twice w/o unlocking in between:
One in line 56 and second one here.
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.
@ripcurld0 HandleHTTPRequest
does not call this function but directly the one that assumes lock has already been taken.
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 sorry, my bad. I didn't notice I am mixing between handleConn
and HandleConn
.
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 🌵
|
||
dialer := session.Dialer(testutil.TestStream(testutil.Handler(m.HandleConn))) | ||
|
||
g, ctx := errgroup.WithContext(context.Background()) |
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.
TIL errgroup :P
LGTM |
@tonistiigi test timed out on windows, maybe it's related ? |
@vieux I can't see how it could be as it doesn't do anything with build. For the reference:
|
All green, merging |
This PR enables path filtering capabilities to the file send stream so that it can be used in the future for the builder to only ask the paths that are actually needed or for transferring individual files(for example Dockerfile). This was described as follow-up in #32677 as optional but it occurred to me that if a client doesn't have support for this then future daemons would need to detect if clients have support for this or not(possible but harder to maintain). The
fsutil
package already had support for this but it was not enabled insession/filesync
.As there isn't a daemon feature that uses it yet I added a test helper that can be used to test the full lifecycle of the session in another commit. Hopefully this will become useful in the future for testing other similar features as well.
@thaJeztah @tiborvass