Adding projects to a devfile
This section describes how to add one or more projects to a devfile.
-
Add a
projects
section in the devfile, containing a list of one or more projects.Example 1. A minimal devfile with one single projectschemaVersion: 2.0.0 metadata: name: petclinic-dev-environment projects: - name: petclinic git: location: 'https://github.com/spring-projects/spring-petclinic.git' branch: master
Example 2. A devfile with multiple projectsschemaVersion: 2.0.0 metadata: name: example-devfile projects: - name: frontend git: location: https://github.com/acmecorp/frontend.git - name: backend git: location: https://github.com/acmecorp/backend.git
-
For each project, define an unique value for the mandatory
name
attribute. -
For each project, define a mandatory source of one of the following types:
git
,github
andzip
.git
-
Projects with sources in Git. The location points to a clone link.
Example 3. Project-source type: gitprojects: - name: my-project1 git: remotes: origin: "https://github.com/my-org/project1.git" checkoutFrom: revision: master (1) tag: 7.2.0 commitId: 36fe587 branch: master
1 startPoint
is the general value fortag
,commitId
, andbranch
. ThestartPoint
,tag
,commitId
, andbranch
parameters are mutually exclusive. When more than one is supplied, the following order is used:startPoint
,tag
,commitId
,branch
. github
-
Same as
git
but for projects hosted on GitHub only. Usegit
for projects that do not use GitHub-specific features. zip
-
Projects with sources in a ZIP archive. Location points to a ZIP file.
Example 4. Project-source type: zipsource: zip: location: http://host.net/path/project-src.zip
-
For each project, define the optional
clonePath
attribute 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 theclonePath
attributeschemaVersion: 2.0.0 metadata: name: my-project-dev 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
sparseCheckoutDir
attribute to populate the project sparsely with selected directories.-
Set to
/my-module/
to create only the rootmy-module
directory (and its content). -
Omit the leading slash (
my-module/
) to create allmy-module
directories that exist in the project. Including, for example,/addons/my-module/
.The trailing slash indicates that only directories with the given name (including their content) are created.
-
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.
-