devspace icon indicating copy to clipboard operation
devspace copied to clipboard

Deploy job while `devspace dev` is running

Open ddziech opened this issue 2 years ago • 1 comments

What happened? I'm trying to deploy a kubernetes job with devspace 6 while devspace dev is running.

  • devspace dev
  • devspace deploy -p xyz-my-job-generate
  • run_dependencies: couldn't execute 'devspace deploy -p xyz-my-job-generate', because there is another DevSpace session for the project (xyz) already running inside this namespace

What did you expect to happen instead? The job inside profile xyz-my-job-generate will be deployed.

How can we reproduce the bug? (as minimally and precisely as possible)

  • the easiest way to generate this case
    • run twice devspace dev in separate consoles
  • In my case:
  • run devspace dev in one console
  • run devspace deploy -p xyz-my-job-generate in another console

My devspace.yaml:

version: v2beta1
name: xyz

vars:
  PHP_IMAGE: "xyz-webapp-php"
  PHP_MY_JOB_IMAGE: "xyz-my-job"
  NGINX_IMAGE: "xyz-webapp-nginx"

deployments:
  webapp:
    namespace: xyz-dev
    kubectl:
      manifests:
        - kustomize/overlays/dev/webapp/
      kustomize: true

dev:
  php:
    imageSelector: '${PHP_IMAGE}'
    sync:
      - path: ./:/app
        excludePaths:
          - .git/
          - .idea/
          - .devspace/
          - var
          - docker
          - terraform
          - k8s
        uploadExcludePaths:
          - node_modules
        initialSync: preferLocal
        printLogs: true
    logs: { }
  nginx:
    imageSelector: '${NGINX_IMAGE}'
    sync:
      - path: ./public:app/public
        initialSync: preferLocal
        disableDownload: true
        printLogs: true
    logs: { }

profiles:
  - name: xyz-my-job-generate
    replace:
      images:
        php:
          image: '${PHP_MY_JOB_IMAGE}'
          tags:
            - 'dev-php-my-job-${DEVSPACE_GIT_COMMIT}-${DEVSPACE_TIMESTAMP}'
          dockerfile: docker/web/Dockerfile
          context: .
          target: php-dev
          buildKit: { }
      deployments:
        xyz-my-job-generate:
          namespace: xyz-dev
          kubectl:
            manifests:
              - kustomize/overlays/dev/my-job/
            kustomize: true

images:
  php:
    image: '${PHP_IMAGE}'
    tags:
      - 'dev-php-${DEVSPACE_GIT_COMMIT}-#####'
    dockerfile: docker/web/Dockerfile
    context: .
    target: php-dev
    buildKit: { }

  nginx:
    image: '${NGINX_IMAGE}'
    tags:
      - 'dev-nginx-${DEVSPACE_GIT_COMMIT}-#####'
    dockerfile: docker/web/Dockerfile
    context: .
    target: nginx-dev
    buildKit: { }

...

Local Environment:

  • DevSpace Version: devspace version 6.2.5
  • Operating System: linux
  • ARCH of the OS: AMD64 Kubernetes Cluster:
  • Cloud Provider: minikube
  • Kubernetes Version: Client Version: v1.24.3 Kustomize Version: v4.5.4 Server Version: v1.22.12

Anything else we need to know? It works in devspace 5 pkg/devspace/pipeline/pipeline.go:108

ddziech avatar Feb 17 '23 07:02 ddziech

Hello! Thanks for reporting this issue. We will look into a fix, since this worked in DevSpace v5.

lizardruss avatar Feb 22 '23 16:02 lizardruss