Skip to content

Commit eddfcd5

Browse files
authored
Merge pull request moby#4049 from sipsma/append-grpc-headers
filesync: append rather than replace grpc md.
2 parents b325bf8 + 4b56395 commit eddfcd5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

session/filesync/filesync.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"unicode"
1212

1313
"github.com/moby/buildkit/session"
14+
"github.com/moby/buildkit/util/bklog"
1415
"github.com/pkg/errors"
1516
"github.com/tonistiigi/fsutil"
1617
fstypes "github.com/tonistiigi/fsutil/types"
@@ -308,9 +309,16 @@ func CopyFileWriter(ctx context.Context, md map[string]string, c session.Caller)
308309

309310
client := NewFileSendClient(c.Conn())
310311

311-
opts := make(map[string][]string, len(md))
312+
opts, ok := metadata.FromOutgoingContext(ctx)
313+
if !ok {
314+
opts = make(map[string][]string, len(md))
315+
}
312316
for k, v := range md {
313-
opts[keyExporterMetaPrefix+k] = []string{v}
317+
k := keyExporterMetaPrefix + k
318+
if existingVal, ok := opts[k]; ok {
319+
bklog.G(ctx).Warnf("overwriting grpc metadata key %q from value %+v to %+v", k, existingVal, v)
320+
}
321+
opts[k] = []string{v}
314322
}
315323

316324
ctx = metadata.NewOutgoingContext(ctx, opts)

0 commit comments

Comments
 (0)