Skip to content

Commit

Permalink
Merge pull request #4049 from sipsma/append-grpc-headers
Browse files Browse the repository at this point in the history
filesync: append rather than replace grpc md.
  • Loading branch information
tonistiigi authored Aug 29, 2023
2 parents b325bf8 + 4b56395 commit eddfcd5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions session/filesync/filesync.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"unicode"

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

client := NewFileSendClient(c.Conn())

opts := make(map[string][]string, len(md))
opts, ok := metadata.FromOutgoingContext(ctx)
if !ok {
opts = make(map[string][]string, len(md))
}
for k, v := range md {
opts[keyExporterMetaPrefix+k] = []string{v}
k := keyExporterMetaPrefix + k
if existingVal, ok := opts[k]; ok {
bklog.G(ctx).Warnf("overwriting grpc metadata key %q from value %+v to %+v", k, existingVal, v)
}
opts[k] = []string{v}
}

ctx = metadata.NewOutgoingContext(ctx, opts)
Expand Down

0 comments on commit eddfcd5

Please sign in to comment.