(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error)
| 268 | } |
| 269 | |
| 270 | func (c *controller) startSync(ctx devspacecontext.Context, options *Options, onInitUploadDone chan struct{}, onInitDownloadDone chan struct{}, onDone chan struct{}, onError chan error) (*sync.Sync, *selector.SelectedPodContainer, error) { |
| 271 | syncConfig := options.SyncConfig |
| 272 | |
| 273 | container, err := options.Selector.SelectSingleContainer(ctx.Context(), ctx.KubeClient(), ctx.Log()) |
| 274 | if err != nil { |
| 275 | return nil, nil, errors.Wrap(err, "error selecting container") |
| 276 | } |
| 277 | |
| 278 | ctx.Log().Debug("Starting sync...") |
| 279 | syncClient, err := c.initClient(ctx, container.Pod, options.Arch, container.Container.Name, syncConfig, options.Starter, options.Verbose, options.SyncLog) |
| 280 | if err != nil { |
| 281 | return nil, nil, errors.Wrap(err, "start sync") |
| 282 | } |
| 283 | |
| 284 | err = syncClient.Start(onInitUploadDone, onInitDownloadDone, onDone, onError) |
| 285 | if err != nil { |
| 286 | return nil, nil, errors.Errorf("Sync error: %v", err) |
| 287 | } |
| 288 | |
| 289 | localPath, remotePath, err := ParseSyncPath(syncConfig.Path) |
| 290 | if err == nil { |
| 291 | ctx.Log().Donef("Sync started on: %s", ansi.Color(fmt.Sprintf("%s <-> %s", localPath, remotePath), "white+b")) |
| 292 | } |
| 293 | |
| 294 | return syncClient, container, nil |
| 295 | } |
| 296 | |
| 297 | func ParseSyncPath(path string) (localPath string, remotePath string, err error) { |
| 298 | if path == "" { |
no test coverage detected