devspace icon indicating copy to clipboard operation
devspace copied to clipboard

sub dir sync

Open hossko opened this issue 3 years ago • 3 comments

Hello,

Running "devspace dev" will do initial file and folder sync into the remote container, but after changing a file in a sub-folder, it doesnot sync. Only the files in the main path "./" will auto sync. Anyone encountered same issue ?

My devspace.yaml:

version: v2beta1
name: result

# This is a list of `pipelines` that DevSpace can execute (you can define your own)
pipelines:
  # This is the pipeline for the main command: `devspace dev` (or `devspace run-pipeline dev`)
  dev:
    run: |-
      run_dependencies --all       # 1. Deploy any projects this project needs (see "dependencies")
      create_deployments --all     # 2. Deploy Helm charts and manifests specfied as "deployments"
      start_dev app                # 3. Start dev mode "app" (see "dev" section)
  # You can run this pipeline via `devspace deploy` (or `devspace run-pipeline deploy`)
  deploy:
    run: |-
      run_dependencies --all                            # 1. Deploy any projects this project needs (see "dependencies")
      build_images --all -t $(git describe --always)    # 2. Build, tag (git commit hash) and push all images (see "images")
      create_deployments --all                          # 3. Deploy Helm charts and manifests specfied as "deployments"

# This is a list of `images` that DevSpace can build for this project
# We recommend to skip image building during development (devspace dev) as much as possible
images:
  app:
    image: docker.io/hossko/result:v1
    dockerfile: ./Dockerfile

# This is a list of `deployments` that DevSpace can create for this project
deployments:
  app:
    # This deployment uses `kubectl` but you can also define `helm` deployments
    kubectl:
      manifests:
        - kube/result-deployment.yaml

# This is a list of `dev` containers that are based on the containers created by your deployments
dev:
  app:
    # Search for the container that runs this image
    imageSelector: docker.io/hossko/result:v1
    # Replace the container image with this dev-optimized image (allows to skip image building during development)
    devImage: ghcr.io/loft-sh/devspace-containers/python:3-alpine
    # Sync files between the local filesystem and the development container
    sync:
      - path: ./
    # Open a terminal and use the following command to start it
    terminal:
      command: ./devspace_start.sh
    # Inject a lightweight SSH server into the container (so your IDE can connect to the remote dev env)
    ssh:
      enabled: true
    # Make the following commands from my local machine available inside the dev container
    proxyCommands:
      - command: devspace
      - command: kubectl
      - command: helm
      - command: git
    # Forward the following ports to be able access your application via localhost
    ports:
      - port: 8080:80
    # Open the following URLs once they return an HTTP status code other than 502 or 503
    open:
      - url: http://localhost:8080

# Use the `commands` section to define repeatable dev workflows for this project 
commands:
  migrate-db:
    command: |-
      echo 'This is a cross-platform, shared command that can be used to codify any kind of dev task.'
      echo 'Anyone using this project can invoke it via "devspace run migrate-db"'

# Define dependencies to other projects with a devspace.yaml
# dependencies:
#   api:
#     git: https://...  # Git-based dependencies
#     tag: v1.0.0
#   ui:
#     path: ./ui        # Path-based dependencies (for monorepos)

Local Environment:

  • DevSpace Version: devspace version 6.0.0-beta.0
  • Operating System: WSL2, Ubuntu
  • ARCH of the OS: AMD64 Kubernetes Cluster:
  • Cloud Provider: Linode
  • Kubernetes Version: v1.24.0

Anything else we need to know?

/kind bug

hossko avatar Jul 27 '22 08:07 hossko

Perhaps you should use ./** instead of ./, that should sync all the files and subdirectories in the same directory as the devspace.yaml

StevenShyaka avatar Jul 29 '22 16:07 StevenShyaka

Hi @StevenShyaka , i already tried this combination. devspace will close the terminal session when this is configured.

hossko avatar Jul 29 '22 17:07 hossko

Hey @hossko ! Unfortunately WSL2 will require you to move the project onto the linux system or otherwise the file sync cannot work as described here: https://github.com/microsoft/WSL/issues/4739

FabianKramm avatar Jul 29 '22 17:07 FabianKramm