Skip to main content
Version: 5.16

Profiles: Activation

The activation option is optional and allows you to activate a profile using regular expression matching of environment variables. An activation is configured with the profile it activates in devspace.yaml.

Example: Defining a Profile Activation#

profiles:
- name: production
activation:
- env:
ENV: "production"
patches:
- op: replace
path: images.backend.image
value: john/prodbackend

The production profile would be activated when the environment variable ENV has value production:

Example: Regular Expression Activation#

profiles:
- name: production
activation:
- env:
ENV: "prod-\d+"
patches:
- op: replace
path: images.backend.image
value: john/prodbackend

The profile production would be activated when the environment variable ENV matches the regular expression prod-\d+. This can be useful for matching environment variables that have dynamic values.

Example: Matching All Environment Variables#

When multiple env name/expression pairs are specified in the same activation, all environment variables values must match the expression to activate the profile. For example, the production profile is activated when both environment variables match their expressions:

profiles:
- name: production
activation:
- env:
CI: "true"
ENV: "development"
patches:
- op: replace
path: images.backend.image
value: john/devbackend

Example: Matching Any Environment Variables#

When environment variables are used in multiple activations, the profile is activated when any environment variable matches. In this example, the production profile is activated when either environment variables match their expressions:

profiles:
- name: production
activation:
- env:
CI: "true"
- env:
ENV: "development"
patches:
- op: replace
path: images.backend.image
value: john/devbackend

Dependency Activations#

When dependencies are referenced from a devspace.yaml, the dependency's profile activations will also be evaluated. In this example, any profile activations in ./component-1/devspace.yaml or ./component-2/devspace.yaml would be evaluated.

dependencies:
- name: component-1
source:
path: ./component-1
- name: component-2
source:
path: ./component-2

Example: Disable Activations by Dependency#

The disableProfileActivation option can be used to disable profile activations for specific dependencies. In the following example, the activations for ./component-1/devspace.yaml would be ignored, while the activations in ./component-2/devspace.yaml would be evaluated:

dependencies:
- name: component-1
source:
path: ./component-1
disableProfileActivation: true
- name: component-2
source:
path: ./component-2

Disable Activations Globally#

The --disable-profile-activation flag can be used to disable all profile activations, including those specifed within each dependency's devspace.yaml.