Skip to content

Commit 0a314c7

Browse files
committed
feat: add --polling flag
1 parent 5195ddb commit 0a314c7

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

cmd/sync.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ type SyncCmd struct {
3333
Pod string
3434
Pick bool
3535
Wait bool
36+
Polling bool
3637

3738
Exclude []string
3839
ContainerPath string
@@ -100,6 +101,7 @@ devspace sync --container-path=/my-path
100101
syncCmd.Flags().BoolVar(&cmd.DownloadOnly, "download-only", false, "If set DevSpace will only download files")
101102

102103
syncCmd.Flags().BoolVar(&cmd.Wait, "wait", true, "Wait for the pod(s) to start if they are not running")
104+
syncCmd.Flags().BoolVar(&cmd.Polling, "polling", false, "If polling should be used to detect file changes in the container")
103105

104106
return syncCmd
105107
}
@@ -301,5 +303,9 @@ func (cmd *SyncCmd) applyFlagsToSyncConfig(syncConfig *latest.SyncConfig) error
301303
syncConfig.InitialSync = latest.InitialSyncStrategy(cmd.InitialSync)
302304
}
303305

306+
if cmd.Polling {
307+
syncConfig.Polling = cmd.Polling
308+
}
309+
304310
return nil
305311
}

e2e/tests/sync/sync.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ var _ = DevSpaceDescribe("sync", func() {
7272
ImageSelector: "node:13.14-alpine",
7373
ContainerPath: "/app",
7474
UploadOnly: true,
75-
// Polling: true,
76-
Interrupt: interrupt,
75+
Polling: true,
76+
Wait: true,
77+
Interrupt: interrupt,
7778
}
7879

7980
// start the command

pkg/devspace/services/synccontroller/controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ func (c *controller) startSync(options *Options, onInitUploadDone chan struct{},
283283
if len(options.TargetOptions.ImageSelector) == 0 {
284284
options.TargetOptions.ImageSelector = []imageselector.ImageSelector{}
285285
}
286+
286287
if syncConfig.ImageSelector != "" {
287288
imageSelector, err := runtimevar.NewRuntimeResolver(true).FillRuntimeVariablesAsImageSelector(syncConfig.ImageSelector, c.config, c.dependencies)
288289
if err != nil {

0 commit comments

Comments
 (0)