github devspace-sh/devspace v5.16.0

latest releases: v6.3.14, v6.3.13, v6.3.12...
3 years ago

Config Expressions

Config expressions are a powerful feature to load the devspace.yaml in a more dynamic way. A config expression works by specifying $( my bash expression ) instead of a field and the stdout of the bash expression is taken as value instead.

Load a deployment specification from file:

deployments:
  - $(cat deployment.yaml)

Change config based on devspace variables:

deployments:
# Inline if-else
- $( [ ${DEVSPACE_NAMESPACE} == "test" ] && cat deployment.yaml || echo "" )
# Multiline if-else
- |-
  $(
    if [ ${DEVSPACE_CONTEXT} == "minikube" ]; then
      cat minikube.yaml
    else
      echo ""
    fi
  )

Generate a complete section

dev: $(./my-script.sh ${DEVSPACE_NAMESPACE} ${DEVSPACE_CONTEXT} ${DEVSPACE_PROFILE})

Return JSON

images:
  test:
    image: my-image/image
    build: '$( echo {"disabled": true} )'

New config version v1beta11:

  • Removed imageName as selector, please use imageSelector: image(name):tag(name) instead
  • Removed dev.logs.images, please use dev.logs.selectors instead
  • Renamed hooks.where.container to hooks.container
  • commands.appendArgs now defaults to false
  • dependencies[*].overrideVars now defaults to false
  • Renamed hooks.when to hooks.events, which is a string array now that supports the following events:
    • before:deploy, after:deploy, before:deploy:[name], after:deploy:[name], error:deploy:[name], skip:deploy:[name]: executed while DevSpace deploys deployments. [name] can be replaced with the config name of a deployment or * to match all.
    • before:render, after:render, before:render:[name], after:render:[name], error:render:[name]: executed while DevSpace renders deployments during devspace render. [name] can be replaced with the config name of a deployment or * to match all.
    • before:purge, after:purge, before:purge:[name], after:purge:[name], error:purge:[name]: executed while DevSpace purges deployments during devspace purge. [name] can be replaced with the config name of a deployment or * to match all.
    • before:build, after:build, before:build:[name], after:build:[name], error:build:[name], skip:build:[name]: executed while DevSpace builds images. [name] can be replaced with the config name of an image or * to match all.
    • start:sync:[name], stop:sync:[name], error:sync:[name], restart:sync:[name], before:initialSync:[name], after:initialSync:[name], error:initialSync:[name]: executed while DevSpace syncs files with dev.sync. [name] can be replaced with the config name of a sync configuration or * to match all.
    • start:portForwarding:[name], restart:portForwarding:[name], error:portForwarding:[name], stop:portForwarding:[name]: executed while DevSpace port forwards with dev.ports. [name] can be replaced with the config name of a port forwarding configuration or * to match all.
    • start:reversePortForwarding:[name], restart:reversePortForwarding:[name], error:reversePortForwarding:[name], stop:reversePortForwarding:[name]: executed while DevSpace reverse port forwards with dev.ports. [name] can be replaced with the config name of a port forwarding configuration or * to match all.
    • before:createPullSecrets, after:createPullSecrets, error:createPullSecrets: executed while DevSpace creates pullSecrets
    • devCommand:before:execute, devCommand:after:execute, devCommand:error, devCommand:interrupt, devCommand:before:sync, devCommand:after:sync, devCommand:before:portForwarding, devCommand:after:portForwarding, devCommand:before:replacePods, devCommand:after:replacePods, devCommand:before:runPipeline, devCommand:after:runPipeline, devCommand:before:deployDependencies, devCommand:after:deployDependencies, devCommand:before:build, devCommand:after:build, devCommand:before:deploy, devCommand:after:deploy, devCommand:before:openTerminal, devCommand:before:streamLogs: executed at certain lifecycle events during the devspace dev command
    • deployCommand:before:execute, deployCommand:after:execute, deployCommand:error, deployCommand:interrupt executed at different checkpoints when devspace deploy is executed
    • purgeCommand:before:execute, purgeCommand:after:execute, purgeCommand:error, purgeCommand:interrupt executed at different checkpoints when devspace purge is executed
    • buildCommand:before:execute, buildCommand:after:execute, buildCommand:error, buildCommand:interrupt executed at different checkpoints when devspace build is executed

Wildcard and filter paths for patches

It is now possible to use filter paths and wildcards in profile & pod patches. For example:

images:
  backend:
    image: john/devbackend
  backend-debugger:
    image: john/debugger
deployments:
- name: backend
  helm:
    componentChart: true
    values:
      containers:
      - image: john/devbackend
      - image: john/debugger
profiles:
- name: staging
  patches:
  - op: replace
    path: ..[?(@.image=='john/devbackend')].image
    value: john/stagingbackend
  - op: remove
    path: deployments..[?(@.image=='john/debugger')]

For more informations take a look at the docs.

Other Changes

  • You can now use image(default) and tag(default) in hook commands and args:
images:
  test:
    image: test/test
hooks:
  - command: |-
      ./custom-script image(test):tag(test) # -> Transformed to ./custom-script test/test:##### 
    when:
      after:
        images: all
  • Added new option hooks[*].container.once that will execute remote container command hooks only once during the lifetime of a container
  • DevSpace will now use a replica set instead of single pod as pod replacement
  • DevSpace will now set the statefulsets pod name as hostname in the replaced pods
  • DevSpace will now also write sync logs to .devspace/logs/sync.log even if shown in terminal
  • DevSpace will now try to restart the terminal if an unexpected exit code occurred during devspace dev. Can be disabled via the flag --terminal-reconnect=false
  • New flag --reconnect for command devspace enter to restart the terminal if an unexpected exit code was encountered
  • New flag --image-selector for commands devspace enter, devspace logs & devspace attach
  • Fixed an issue where pathType was not automatically set for newer ingress versions
  • Fixed an issue where namespace and context were wrong in UI commands
  • Fixed an issue where replacing pods with the same image selector across different devspace.yaml would target the same pods (#1633)
  • Renamed plugin hook names to match config hook names
  • Improved port forwarding & reverse port forwarding logging
  • Fixed an issue where paths that include a symlink would not sync correctly

Don't miss a new devspace release

NewReleases is sending notifications on new releases.