devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.17k stars 351 forks source link

Results of onUpload.exec.command not rendering in the terminal #2863

Open cheslijones opened 3 weeks ago

cheslijones commented 3 weeks ago

What happened?
Trying to run pytest and coverage, and display the results in terminal using onUpload.exec.command.

This is probably just user error. I've asked about it on SO.

What did you expect to happen instead?
That it would display the results, but it does not. You see the command being run, but no results displayed in the terminal.

How can we reproduce the bug? (as minimally and precisely as possible)
It isn't a "problem" unique to pytest or coverage, but getting most types of feedback from the container in the terminal. The easiest way to reproduce it is any of the following:

dev:
  sync:
    ...
    onUpload:
      exec:
      - command: ls
# or 
    onUpload:
      exec:
      - command: bash -c "ls"
 # or 
    onUpload:
      exec:
      - command: kubectl exec -it pod-0 -- ls
        local: true
# or
    onUpload:
      exec:
      - command: kubectl exec -it pod-0 -- bash -c "ls"
        local: true

In each case you'll see the command being run, but not the results:

[api-ut] Upstream - Successfully processed 1 change(s)
[api-ut] Upstream - Execute command 'ls'
[api-ut] Upstream - Done executing command

My devspace.yaml:

version: v1beta11
...
images:
  api-ut:
    image: ${APP_NAME}/${API_DEV}-ut
    dockerfile: ${API}/docker/Dockerfile
    context: ${API}/
    build:
      buildKit:
        args: 
          - "--progress=plain"
        options:
          target: unit-tests
...
deployments:
  - name: ${API}-ut
    helm:
      componentChart: true
      values:
        containers:
          - image: ${APP_NAME}/${API_DEV}-ut
        service:
          ports:
            - port: 5001
...
dev:
  sync:
    - name: ${API}-ut
      imageSelector: ${APP_NAME}/${API_DEV}-ut
      localSubPath: ./${API}
      excludeFile: .dockerignore
      waitInitialSync: true
      onUpload:
        exec:
          - command: coverage run --omit='src/manage.py,src/config/*,*/.venv/*,*/*__init__.py,*/tests.py,*/admin.py,*/migrations/*,*/apps.py' -m pytest -m=ut

Local Environment:

Anything else we need to know?
That should cover it. More than likely something I'm doing wrong.