Deploy Path-Based Local Dependencies
Example
dependencies:
- name: component-1
source:
path: ./different/component-1
- name: component-2
source:
path: ./different/component-2
deployments:
- name: use-dependency-image
helm:
componentChart: true
values:
containers:
- image: ${runtime.dependencies.component-1.image1}
source
source.path
The source.path option expects a string with a relative path to a folder that contains a devspace.yaml which marks a project that is a dependency of the project referencing it.
Example: Local Project as Dependency
dependencies:
- source:
path: ../other-project
- source:
path: ./different/subproject
Explanation:
- Whenever you run
devspace deployordevspace dev, DevSpace will:- Load the
devspace.yamlfiles of both dependencies and resolve their dependencies respectively. - Deploy both projects according to their
devspace.yamlfiles.
- Load the
source.configName
The source.configName option is optional and specifies the dependency's DevSpace configuration file name. If not provided, devspace.yaml at the dependency source.path will be used.
Default Value For source.configName
configName: devspace.yaml
Example: Use dev.yaml for Dependency's DevSpace Configuration
# This will use the file component-1/dev.yaml
# for the dependency's DevSpace configuration
dependencies:
- source:
path: component-1
configName: dev.yaml
General Options
profile
The profile option expects a string with the name of a profile defined in the devspace.yaml of this dependency. When configuring this option, this profile will be used to deploy the dependency, i.e. the dependency will be deployed similar to running devspace deploy -p [profile] within the folder of the dependency.
Example: Use Config Profile for Dependency
dependencies:
- source:
git: https://github.com/my-api-server
profile: production
skipBuild
The skipBuild option expects a boolean that defines if the image building process should be skipped when deploying this dependency. This is often useful if you rather want to use the tags that are defined in the deployment files (e.g. manifests or helm charts) which may reference more stable, production-like versions of the images.
Using skipBuild is useful when trying to speed up the dependency deployment process, especially when working with many dependencies that frequently change.
Default Value For skipBuild
skipBuild: false
Example: Skip Build for Dependency
dependencies:
- source:
git: https://github.com/my-api-server
skipBuild: true
ignoreDependencies
The ignoreDependencies option expects a boolean that defines if the dependencies of this dependencies should not be resolved and deployed.
Using ignoreDependencies can be useful to prevent problematic circular dependencies.
Default Value For ignoreDependencies
ignoreDependencies: false
Example: Ignore Dependencies of Dependency
dependencies:
- source:
git: https://github.com/my-api-server
ignoreDependencies: true
name
The name option is optional and expects a string stating the name of this dependency.
Adding a name for a dependency makes it possible to reference the dependency using flags, e.g.
devspace deploy --dependency=[name]
devspace purge --dependency=[name]
devspace render --dependency=[name]
namespace
The namespace option is optional and expects a string stating a namespace that should be used to deploy the dependency to.
By default, DevSpace deploys project dependencies in the same namespace as the project itself.
You should only use the namespace option if you are an advanced user because using this option requires any user that deploys this project to be able to create this namespace during the deployment process or to have access to the namespace with the current kube-context, if the namespace already exists.
vars
The vars option expects an array of objects with name and value of variables defined in the devspace.yaml of this dependency. When configuring this option, the variables will be overriden similar to passing variables via the --var flag to devspace.
It is also useful to deploy the same dependency multiple times with just small adjustments.
Example: Override Config Vars for Dependency
# This will deploy the api server two times with
# different variable configurations
dependencies:
- source:
git: https://github.com/my-api-server
vars:
- name: NAME
value: api-server-1
- source:
git: https://github.com/my-api-server
vars:
- name: NAME
value: api-server-2
overwriteVars
The overwriteVars option is optional and expects a boolean. If this option is enabled it will overwrite all defined variables within the dependency config with the values of the variables defined in the base config. Variables that are not used or not defined within the base config aren't overwritten in the dependency config.
For example:
# devspace.yaml
vars:
- name: DEFINED_AND_USED
value: my-base-value
- name: DEFINED_AND_NOT_USED
value: my-other-base-value
dependencies:
- name: dep1
source:
path: dep1
overwriteVars: true
# If overwriteVars is true, all variables that are used within this
# config are passed to the dependency and will overwrite the values of variables with
# the same name there. In this case only the variable DEFINED_AND_USED
# will be passed to the dependency, as DEFINED_AND_NOT_USED is not used within the config.
# overwriteVars: true
#
# If you want to pass the variable DEFINED_AND_NOT_USED to the dependency as well,
# you can either use it somewhere within the config or explicitly pass it to the dependency with vars.
# vars:
# - name: DEFINED_AND_NOT_USED
# value: ${DEFINED_AND_NOT_USED}
deployments:
- name: deployment
helm:
componentChart: true
values:
containers:
- image: ${DEFINED_AND_USED}
and
# dep1/devspace.yaml
vars:
- name: DEFINED_AND_USED
value: my-dep-value
- name: DEFINED_AND_NOT_USED
value: my-other-dep-value
deployments:
# This will be my-other-dep-value
- name: ${DEFINED_AND_NOT_USED}
helm:
componentChart: true
values:
containers:
# This will be my-base-value
- image: ${DEFINED_AND_USED}
dev
The dev option allows you to reuse certain parts of a dependencies dev configuration.
If dev configuration is reused this will be merged into the top-level devspace.yaml and executed after image building and deployment
Example: Override Config Vars for Dependency
# This will use the dev.ports configuration of the dependency
# component-1
dependencies:
- source:
path: component-1
dev:
ports: true
dev.ports
If enabled will reuse the dependency's dev.ports configuration.
dev.sync
If enabled will reuse the dependency's dev.sync configuration. The base path of the sync configurations reused from a dependency is the folder where the dependency is saved in and not the current working directory.
dev.replacePods
If enabled will reuse the dependency's dev.replacePods configuration.
