To quickly and easily configure a Che workspace, use a devfile. For an introduction to devfiles and instructions for their use, see below.
What is a devfile
A devfile is a file that describes and define a development environment:
-
the source code
-
the development components (browser IDE tools and application runtimes)
-
a list of pre-defined commands
-
projects to clone
Devfiles are YAML files that Che consumes and transforms into a cloud workspace composed of multiple containers. The devfile can be saved in the root folder of a Git repository, a feature branch of a Git repository, a publicly accessible destination, or as a separate, locally stored artifact.
When creating a workspace, Che uses that definition to initiate everything and run all the containers for the required tools and application runtimes. Che also mounts file-system volumes to make source code available to the workspace.
Devfiles can be versioned with the project source code. When there is a need for a workspace to fix an old maintenance branch, the project devfile provides a definition of the workspace with the tools and the exact dependencies to start working on the old branch. Use it to instantiate workspaces on demand.
Che maintains the devfile up-to-date with the tools used in the workspace:
-
Projects of the workspace (path, Git location, branch)
-
Commands to perform daily tasks (build, run, test, debug)
-
Runtime environment (container images to run the application)
-
Che-Theia plug-ins with tools, IDE features, and helpers that a developer would use in the workspace (Git, Java support, Sonarlint, Pull Request)
Creating a workspace from the default branch of a Git repository
A Che workspace can be created by pointing to a devfile that is stored in a Git source repository. The Che instance then uses the discovered devfile.yaml file to build a workspace using the /f?url= API.
-
A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che quick-starts.
-
The
devfile.yamlfile in the root folder of a Git repository available over HTTPS. See Making a workspace portable using a devfile for detailed information about creating and using devfiles.
Run the workspace by opening the following URL: https://<CheHost>/f?url=https://<GitRepository>
https://che.openshift.io/f?url=https://github.com/eclipse/che
Creating a workspace from a feature branch of a Git repository
A Che workspace can be created by pointing to devfile that is stored in a Git source repository on a feature branch of the user’s choice. The Che instance then uses the discovered devfile to build a workspace.
-
A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che quick-starts.
-
The
devfile.yamlfile in the root folder of a Git repository on a specific branch of the user’s choice available over HTTPS. See Making a workspace portable using a devfile for detailed information about creating and using devfiles.
Execute the workspace by opening the following URL: https://<CheHost>/f?url=<GitHubBranch>
Use following URL format to open an experimental quarkus-quickstarts branch hosted on che.openshift.io.
https://che.openshift.io/f?url=https://github.com/maxandersen/quarkus-quickstarts/tree/che
Creating a workspace from a publicly accessible standalone devfile using HTTP
A workspace can be created using a devfile, the URL of which is pointing to the raw content of the devfile. The Che instance then uses the discovered devfile to build a workspace.
-
A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che quick-starts.
-
The publicly-accessible standalone
devfile.yamlfile. See Making a workspace portable using a Devfile for detailed information about creating and using devfiles.
-
Execute the workspace by opening the following URL:
https://<your-che-host>/f?url=https://<yourhosturl>/devfile.yaml
https://che.openshift.io/f?url=https://gist.githubusercontent.com/themr0c/ef8e59a162748a8be07e900b6401e6a8/raw/8802c20743cde712bbc822521463359a60d1f7a9/devfile.yaml
Creating a workspace using chectl and a local devfile
A Che workspace can be created by pointing the chectl tool to a locally stored devfile. The Che instance then uses the discovered devfile to build a workspace.
-
A running instance of Eclipse Che. To install an instance of Eclipse Che, see Che quick-starts.
-
The
chectlcommand-line tool for managing a Che server and its development workspaces. See Installing thechectlmanagement tool. -
The devfile is available on the local filesystem in the current working directory. See Making a workspace portable using a Devfile for detailed information about creating and using devfiles.
ExampleDownload the
devfile.yamlfile from the GitHub repository to the current working directory.
-
Run a workspace from a devfile using the
workspace:startparameter with thechectltool as follows:
$ chectl workspace:start --devfile=devfile.yaml