Adding projects to a devfile
This section describes how to add one or more projects to a devfile. Each starter project can contain either a git or zip object. See the following tables for project properties in a devfile:
| Key | Type | Required | Description |
|---|---|---|---|
name |
string |
yes |
The name of your devfile. |
description |
string |
no |
The description of your starterProject. |
clonePath |
string |
no |
The path relative to the root of your projects. Clone your projects into this path. |
| Key | Type | Required | Description |
|---|---|---|---|
checkoutFrom |
string |
no |
The location of your git repository. |
remotes |
string |
yes |
The branch that you use. |
| Key | Type | Required | Description |
|---|---|---|---|
location |
string |
no |
The location of your zip. |
-
Add a
projectssection in the devfile, containing a list of one or more projects.Example 1. A minimal devfile with one single projectschemaVersion: 2.1.0 metadata: name: petclinic-dev-environment version: 1.0.0 projects: - name: petclinic git: remotes: origin: "https://github.com/spring-projects/spring-petclinic.git" checkoutFrom: revision: mainExample 2. A devfile with multiple projectsschemaVersion: 2.1.0 metadata: name: example-devfile version: 1.0.0 projects: - name: frontend git: remotes: origin: "https://github.com/acmecorp/frontend.git" - name: backend git: remotes: origin: "https://github.com/acmecorp/backend.git" -
For each project, define an unique value for the mandatory
nameattribute. -
For each project, define a mandatory source of either the
gitorziptype.git-
Projects with sources in Git.
checkoutFromrefers to the branch being used.Example 3. Project-source type: gitprojects: - name: my-project1 git: remotes: origin: "https://github.com/my-org/project1.git" checkoutFrom: revision: main (1) zip-
Projects with sources in a ZIP archive.
locationrefers to the URL of a ZIP file.Example 4. Project-source type: zipsource: zip: location: http://host.net/path/project-src.zip
-
For each project, define the optional
clonePathattribute to specify the path into which the project is to be cloned. The path must be relative to the/projects/directory, and it cannot leave the/projects/directory. The default value is the project name.Example 5. Defining theclonePathattributeschemaVersion: 2.1.0 metadata: name: my-project-dev version: 2.0.0 projects: - name: my-project-resource clonePath: resources/my-project zip: location: http://host.net/path/project-res.zip - name: my-project2 git: remotes: origin: "https://github.com/my-org/project2.git" checkoutFrom: revision: develop -
For each project, define the optional
sparseCheckoutDirattribute to populate the project sparsely with selected directories.-
Set the project to
/my-module/to create only the rootmy-moduledirectory along with its content. -
Omit the leading slash (
my-module/) to create allmy-moduledirectories that exist in the project. Including, for example,/addons/my-module/.-
Add a trailing slash to create only directories with the given name (and its content).
-
-
Use wildcards to specify more than one directory name. For example, setting
module-*checks out all directories of the given project that start withmodule-.
For more information, see Sparse checkout in Git documentation.
-