Deploy Git-based Dependencies
Example
dependencies:
- source:
git: https://github.com/my-api-server
branch: stable
- source:
git: https://github.com/my-auth-server
revision: c967392
profile: production
- source:
git: https://github.com/my-database-server
tag: v3.0.1
subPath: /configuration
DevSpace is using the git credential store. So, if you are able to clone or pull from the specified repository, DevSpace will also be able clone or pull this repository.
source
source.git
The source.git
option expects a string with the URL of a git repository. DevSpace will use the master
branch by default and assumes that the devspace.yaml
is located at the root directory of the git repository. To customize this behavior, use the following, complementary config options:
branch
for a different git branchtag
for a specific git tag or releaserevision
for a specific git commit hashsubPath
for custom location ofdevspace.yaml
within the repository
DevSpace will clone the git repository which is defined as a dependency and cache the project in the global cache folder (i.e. $HOME/.devspace
). DevSpace will also pull new commits before deploying the dependency.
Example: Git Projects as Dependency
dependencies:
- source:
git: https://github.com/my-api-server
branch: stable
- source:
git: https://github.com/my-auth-server
revision: c967392
- source:
git: https://github.com/my-auth-server
tag: v3.0.1
Explanation:
- When you run
devspace deploy
ordevspace dev
for the first time after defining the dependencies, DevSpace will check out all git projects into the global cache folder$HOME/.devspace
. - Whenever you run
devspace deploy
ordevspace dev
(even the first time), DevSpace will:- Run a
git pull
for all cached repositories. - Load the
devspace.yaml
files of the dependency projects and resolve their dependencies respectively. - Deploy all dependency projects according to their
devspace.yaml
files.
- Run a
source.branch
The source.branch
option expects a string stating the branch of the git repository referenced via source.git
that should be used when deploying this dependency.
Default Value For source.branch
branch: master
source.tag
The source.tag
option expects a string stating a tag of the git repository referenced via source.git
that should be used when deploying this dependency.
source.revision
The source.revision
option expects a string stating a commit hash of the git repository referenced via source.git
that should be used when deploying this dependency.
source.subPath
The source.subPath
option expects a string stating a folder within the git repository referenced via source.git
that contains the devspace.yaml
for this dependency.
Default Value For source.subPath
subPath: /
Git Options
source.disableShallow
The source.disableShallow
option expects a boolean that prevents DevSpace from using shallow clones (git flag --depth 1
) when retrieving a dependency via git clone.
DevSpace uses shallow clones of git dependencies which reduces the time to retrieve the dependency.
Default Value For source.disableShallow
disableShallow: false
source.cloneArgs
The source.cloneArgs
option expects an array of additional arguments that DevSpace will pass when cloning a git dependency using the git clone
command.
Default Value For source.cloneArgs
cloneArgs: []
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.