Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package cmd
import (
"context"
"fmt"
"os"

runtimevar "github.com/loft-sh/devspace/pkg/devspace/config/loader/variable/runtime"
"github.com/loft-sh/devspace/pkg/devspace/config/localcache"
"github.com/loft-sh/devspace/pkg/devspace/config/versions"
devspacecontext "github.com/loft-sh/devspace/pkg/devspace/context"
"github.com/loft-sh/devspace/pkg/devspace/kubectl"
"github.com/loft-sh/devspace/pkg/devspace/services/sync"
"os"

"github.com/loft-sh/devspace/pkg/devspace/hook"

Expand Down Expand Up @@ -63,18 +64,17 @@ func NewSyncCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Comman
Use: "sync",
Short: "Starts a bi-directional sync between the target container and the local path",
Long: `
#######################################################
################### devspace sync #####################
#######################################################
Starts a bi-directionaly sync between the target container
and the current path:

devspace sync
devspace sync --local-path=subfolder --container-path=/app
devspace sync --exclude=node_modules --exclude=test
devspace sync --pod=my-pod --container=my-container
devspace sync --container-path=/my-path
#######################################################`,
#############################################################################
################### devspace sync ###########################################
#############################################################################
Starts a bi-directional(default) sync between the target container path
and local path:

devspace sync --path=.:/app # localPath is current dir and remotePath is /app
devspace sync --path=.:/app --image-selector nginx:latest
devspace sync --path=.:/app --exclude=node_modules,test
devspace sync --path=.:/app --pod=my-pod --container=my-container
#############################################################################`,
RunE: func(cobraCmd *cobra.Command, args []string) error {
// Print upgrade message if new version available
upgrade.PrintUpgradeMessage(f.GetLog())
Expand Down
22 changes: 10 additions & 12 deletions docs/pages/cli/devspace_sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ devspace sync [flags]
```

```
#######################################################
################### devspace sync #####################
#######################################################
Starts a bi-directionaly sync between the target container
and the current path:
#############################################################################
################### devspace sync ###########################################
#############################################################################
Starts a bi-directional(default) sync between the target container path
and local path:

devspace sync
devspace sync --local-path=subfolder --container-path=/app
devspace sync --exclude=node_modules --exclude=test
devspace sync --pod=my-pod --container=my-container
devspace sync --container-path=/my-path
#######################################################
devspace sync --path=.:/app # localPath is current dir and remotePath is /app
devspace sync --path=.:/app --image-selector nginx:latest
devspace sync --path=.:/app --exclude=node_modules,test
devspace sync --path=.:/app --pod=my-pod --container=my-container
#############################################################################`
```


Expand Down Expand Up @@ -66,4 +65,3 @@ devspace sync --container-path=/my-path
-s, --switch-context Switches and uses the last kube context and namespace that was used to deploy the DevSpace project
--var strings Variables to override during execution (e.g. --var=MYVAR=MYVALUE)
```

20 changes: 19 additions & 1 deletion docs/pages/configuration/dev/connections/file-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,25 @@ This option is often useful if you want to download a dependency folder (e.g. `n
:::


## Start sync log
By default the sync log is disabled but it can be enabled with option `printLogs: true`.

```yaml {11-13}
deployments:
app-backend:
helm:
values:
containers:
- image: ghcr.io/org/project/image

dev:
my-dev:
imageSelector: ghcr.io/org/project/image
sync:
- path: ./
printLogs: true
```

## Sync-Triggered Actions
Sometimes it is useful to execute commands after the sync uploads files/directories between the local filesystem and the container.

Expand Down Expand Up @@ -409,7 +428,6 @@ Polling might increase CPU consumption of the container drastically, depending o
If the `noWatch` option is specified, DevSpace will stop syncing after initially comparing and resolving differences. This is useful if you want a one-time sync, but then continue doing other steps in your pipeline.



## FAQ

<details>
Expand Down