MCPcopy Index your code
hub / github.com/devspace-sh/devspace / upload

Function upload

pkg/devspace/hook/upload.go:58–74  ·  view source on GitHub ↗
(ctx context.Context, client kubectl.Client, pod *v1.Pod, container string, localPath string, containerPath string)

Source from the content-addressed store, hash-verified

56}
57
58func upload(ctx context.Context, client kubectl.Client, pod *v1.Pod, container string, localPath string, containerPath string) error {
59 // do the actual copy
60 reader, writer := io.Pipe()
61 errorChan := make(chan error)
62 go func() {
63 defer reader.Close()
64 errorChan <- uploadFromReader(ctx, client, pod, container, containerPath, reader)
65 }()
66 go func() {
67 defer writer.Close()
68 errorChan <- makeTar(localPath, containerPath, writer)
69 }()
70 err := <-errorChan
71 // wait for the second goroutine to finish
72 <-errorChan
73 return err
74}
75
76func uploadFromReader(ctx context.Context, client kubectl.Client, pod *v1.Pod, container, containerPath string, reader io.Reader) error {
77 cmd := []string{"tar", "xzp"}

Callers 1

ExecuteRemotelyMethod · 0.85

Calls 3

uploadFromReaderFunction · 0.85
makeTarFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected