Este contenido no está disponible en el idioma seleccionado.
Chapter 1. Getting started with Dev Spaces
If your organization is already running a OpenShift Dev Spaces instance, you can get started as a new user by learning how to start a new workspace, manage your workspaces, and authenticate yourself to a Git server from a workspace:
- Section 1.1, “Starting a workspace from a Git repository URL”
- Section 1.1.1, “Optional parameters for the URLs for starting a new workspace”
- Section 1.2, “Starting a workspace from a raw devfile URL”
- Section 1.3, “Basic actions you can perform on a workspace”
- Section 1.4, “Authenticating to a Git server from a workspace”
1.1. Starting a workspace from a Git repository URL
With OpenShift Dev Spaces, you can use a URL in your browser to start a new workspace that contains a clone of a Git repository. This way, you can clone a Git repository that is hosted on GitHub, GitLab, Bitbucket or Microsoft Azure DevOps server instances.
You can also use the Git Repository URL field on the Create Workspace page of your OpenShift Dev Spaces dashboard to enter the URL of a Git repository to start a new workspace.
- Starting a workspace using a URL from a Git service other than GitHub, GiLab, Bitbucket, or Microsoft Azure DevOps will fail.
- If you use an SSH URL to start a new workspace, you must propagate the SSH key. See Configuring DevWorkspaces to use SSH keys for Git operations for more information.
-
If the SSH URL points to a private repository, you must apply an access token to be able to fetch the
devfile.yaml
content. You can do this either by accepting an SCM authentication page or following a Personal Access Token procedure.
Configure personal access token to access private repositories. See Section 6.1.2, “Using a Git-provider access token”.
Prerequisites
- Your organization has a running instance of OpenShift Dev Spaces.
-
You know the FQDN URL of your organization’s OpenShift Dev Spaces instance:
https://<openshift_dev_spaces_fqdn>
. - Optional: You have authentication to the Git server configured.
Your Git repository maintainer keeps the
devfile.yaml
or.devfile.yaml
file in the root directory of the Git repository. (For alternative file names and file paths, see Section 1.1.1, “Optional parameters for the URLs for starting a new workspace”.)TipYou can also start a new workspace by supplying the URL of a Git repository that contains no devfile. Doing so results in a workspace with Universal Developer Image and with Microsoft Visual Studio Code - Open Source as the workspace IDE.
Procedure
To start a new workspace with a clone of a Git repository:
- Optional: Visit your OpenShift Dev Spaces dashboard pages to authenticate to your organization’s instance of OpenShift Dev Spaces.
Visit the URL to start a new workspace using the basic syntax:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>
TipYou can extend this URL with optional parameters:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?<optional_parameters> 1
TipYou can use Git+SSH URLs to start a new workspace. See Configuring DevWorkspaces to use SSH keys for Git operations
Example 1.1. A URL for starting a new workspace
-
https://<openshift_dev_spaces_fqdn>#https://github.com/che-samples/cpp-hello-world
-
https://<openshift_dev_spaces_fqdn>#git@github.com:che-samples/cpp-hello-world.git
Example 1.2. The URL syntax for starting a new workspace with a clone of a GitHub instance repository
-
https://<openshift_dev_spaces_fqdn>#https://<github_host>/<user_or_org>/<repository>
starts a new workspace with a clone of the default branch. -
https://<openshift_dev_spaces_fqdn>#https://<github_host>/<user_or_org>/<repository>/tree/<branch_name>
starts a new workspace with a clone of the specified branch. -
https://<openshift_dev_spaces_fqdn>#https://<github_host>/<user_or_org>/<repository>/pull/<pull_request_id>
starts a new workspace with a clone of the branch of the pull request. -
https://<openshift_dev_spaces_fqdn>#git@<github_host>:<user_or_org>/<repository>.git
starts a new workspace from Git+SSH URL.
Example 1.3. The URL syntax for starting a new workspace with a clone of a GitLab instance repository
-
https://<openshift_dev_spaces_fqdn>#https://<gitlab_host>/<user_or_org>/<repository>
starts a new workspace with a clone of the default branch. -
https://<openshift_dev_spaces_fqdn>#https://<gitlab_host>/<user_or_org>/<repository>/-/tree/<branch_name>
starts a new workspace with a clone of the specified branch. -
https://<openshift_dev_spaces_fqdn>#git@<gitlab_host>:<user_or_org>/<repository>.git
starts a new workspace from Git+SSH URL.
Example 1.4. The URL syntax for starting a new workspace with a clone of a BitBucket Server repository
-
https://<openshift_dev_spaces_fqdn>#https://<bb_host>/scm/<project-key>/<repository>.git
starts a new workspace with a clone of the default branch. -
https://<openshift_dev_spaces_fqdn>#https://<bb_host>/users/<user_slug>/repos/<repository>/
starts a new workspace with a clone of the default branch, if a repository was created under the user profile. -
https://<openshift_dev_spaces_fqdn>#https://<bb_host>/users/<user-slug>/repos/<repository>/browse?at=refs%2Fheads%2F<branch-name>
starts a new workspace with a clone of the specified branch. -
https://<openshift_dev_spaces_fqdn>#git@<bb_host>:<user_slug>/<repository>.git
starts a new workspace from Git+SSH URL.
Example 1.5. The URL syntax for starting a new workspace with a clone of a Microsoft Azure DevOps Git repository
-
https://<openshift_dev_spaces_fqdn>#https://<organization>@dev.azure.com/<organization>/<project>/_git/<repository>
starts a new workspace with a clone of the default branch. -
https://<openshift_dev_spaces_fqdn>#https://<organization>@dev.azure.com/<organization>/<project>/_git/<repository>?version=GB<branch>
starts a new workspace with a clone of the specific branch. -
https://<openshift_dev_spaces_fqdn>#git@ssh.dev.azure.com:v3/<organization>/<project>/<repository>
starts a new workspace from Git+SSH URL.
After you enter the URL to start a new workspace in a browser tab, the workspace starting page appears.
When the new workspace is ready, the workspace IDE loads in the browser tab.
A clone of the Git repository is present in the filesystem of the new workspace.
The workspace has a unique URL:
https://<openshift_dev_spaces_fqdn>/<user_name>/<unique_url>
.-
Additional resources
1.1.1. Optional parameters for the URLs for starting a new workspace
When you start a new workspace, OpenShift Dev Spaces configures the workspace according to the instructions in the devfile. When you use a URL to start a new workspace, you can append optional parameters to the URL that further configure the workspace. You can use these parameters to specify a workspace IDE, start duplicate workspaces, and specify a devfile file name or path.
- Section 1.1.1.1, “URL parameter concatenation”
- Section 1.1.1.2, “URL parameter for the IDE”
- Section 1.1.1.3, “URL parameter for starting duplicate workspaces”
- Section 1.1.1.4, “URL parameter for the devfile file name”
- Section 1.1.1.5, “URL parameter for the devfile file path”
- Section 1.1.1.6, “URL parameter for the workspace storage”
- Section 1.1.1.7, “URL parameter for additional remotes”
- Section 1.1.1.8, “URL parameter for a container image”
1.1.1.1. URL parameter concatenation
The URL for starting a new workspace supports concatenation of multiple optional URL parameters by using &
with the following URL syntax:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?<url_parameter_1>&<url_parameter_2>&<url_parameter_3>
Example 1.6. A URL for starting a new workspace with the URL of a Git repository and optional URL parameters
The complete URL for the browser:
https://<openshift_dev_spaces_fqdn>#https://github.com/che-samples/cpp-hello-world?new&che-editor=che-incubator/intellij-community/latest&devfilePath=tests/testdevfile.yaml
Explanation of the parts of the URL:
https://<openshift_dev_spaces_fqdn> 1 #https://github.com/che-samples/cpp-hello-world 2 ?new&che-editor=che-incubator/intellij-community/latest&devfilePath=tests/testdevfile.yaml 3
1.1.1.2. URL parameter for the IDE
You can use the che-editor=
URL parameter to specify a supported IDE when starting a workspace.
Use the che-editor=
parameter when you cannot add or edit a /.che/che-editor.yaml
file in the source-code Git repository to be cloned for workspaces.
The che-editor=
parameter overrides the /.che/che-editor.yaml
file.
This parameter accepts two types of values:
che-editor=<editor_key>
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?che-editor=<editor_key>
Table 1.1. The URL parameter <editor_key> values for supported IDEs IDE <editor_key>
valueNote che-incubator/che-code/latest
This is the default IDE that loads in a new workspace when the URL parameter or
che-editor.yaml
is not used.che-incubator/che-idea/latest
Technology Preview. Use the Dashboard to select this IDE.
che-editor=<url_to_a_file>
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?che-editor=<url_to_a_file>1
- 1
- URL to a file with devfile content.
Tip- The URL must point to the raw file content.
-
To use this parameter with a
che-editor.yaml
file, copy the file with another name or path, and remove the line withinline
from the file.
- The che-editors.yaml file features the devfiles of all supported IDEs.
1.1.1.3. URL parameter for starting duplicate workspaces
Visiting a URL for starting a new workspace results in a new workspace according to the devfile and with a clone of the linked Git repository.
In some situations, you might need to have multiple workspaces that are duplicates in terms of the devfile and the linked Git repository. You can do this by visiting the same URL for starting a new workspace with a URL parameter.
The URL parameter for starting a duplicate workspace is new
:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?new
If you currently have a workspace that you started using a URL, then visiting the URL again without the new
URL parameter results in an error message.
1.1.1.4. URL parameter for the devfile file name
When you visit a URL for starting a new workspace, OpenShift Dev Spaces searches the linked Git repository for a devfile with the file name .devfile.yaml
or devfile.yaml
. The devfile in the linked Git repository must follow this file-naming convention.
In some situations, you might need to specify a different, unconventional file name for the devfile.
The URL parameter for specifying an unconventional file name of the devfile is df=<filename>.yaml
:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?df=<filename>.yaml 1
- 1
<filename>.yaml
is an unconventional file name of the devfile in the linked Git repository.
The df=<filename>.yaml
parameter also has a long version: devfilePath=<filename>.yaml
.
1.1.1.5. URL parameter for the devfile file path
When you visit a URL for starting a new workspace, OpenShift Dev Spaces searches the root directory of the linked Git repository for a devfile with the file name .devfile.yaml
or devfile.yaml
. The file path of the devfile in the linked Git repository must follow this path convention.
In some situations, you might need to specify a different, unconventional file path for the devfile in the linked Git repository.
The URL parameter for specifying an unconventional file path of the devfile is devfilePath=<relative_file_path>
:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?devfilePath=<relative_file_path> 1
- 1
<relative_file_path>
is an unconventional file path of the devfile in the linked Git repository.
1.1.1.6. URL parameter for the workspace storage
If the URL for starting a new workspace does not contain a URL parameter specifying the storage type, the new workspace is created in ephemeral or persistent storage, whichever is defined as the default storage type in the CheCluster
Custom Resource.
The URL parameter for specifying a storage type for a workspace is storageType=<storage_type>
:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?storageType=<storage_type> 1
- 1
- Possible
<storage_type>
values:-
ephemeral
-
per-user
(persistent) -
per-workspace
(persistent)
-
With the ephemeral
or per-workspace
storage type, you can run multiple workspaces concurrently, which is not possible with the default per-user
storage type.
Additional resources
1.1.1.7. URL parameter for additional remotes
When you visit a URL for starting a new workspace, OpenShift Dev Spaces configures the origin
remote to be the Git repository that you specified with #
after the FQDN URL of your organization’s OpenShift Dev Spaces instance.
The URL parameter for cloning and configuring additional remotes for the workspace is remotes=
:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?remotes={{<name_1>,<url_1>},{<name_2>,<url_2>},{<name_3>,<url_3>},...}
-
If you do not enter the name
origin
for any of the additional remotes, the remote from <git_repository_url> will be cloned and namedorigin
by default, and its expected branch will be checked out automatically. -
If you enter the name
origin
for one of the additional remotes, its default branch will be checked out automatically, but the remote from <git_repository_url> will NOT be cloned for the workspace.
1.1.1.8. URL parameter for a container image
You can use the image
parameter to use a custom reference to a container image in the following scenarios:
- The Git repository contains no devfile, and you want to start a new workspace with the custom image.
-
The Git repository contains a devfile, and you want to override the first container image listed in the
components
section of the devfile.
The URL parameter for the path to the container image is image=
:
https://<openshift_dev_spaces_fqdn>#<git_repository_url>?image=<container_image_url>
Example
https://<openshift_dev_spaces_fqdn>#https://github.com/eclipse-che/che-docs?image=quay.io/devfile/universal-developer-image:ubi8-latest
1.2. Starting a workspace from a raw devfile URL
With OpenShift Dev Spaces, you can open a devfile URL in your browser to start a new workspace.
You can use the Git Repo URL field on the Create Workspace page of your OpenShift Dev Spaces dashboard to enter the URL of a devfile to start a new workspace.
To initiate a clone of the Git repository in the filesystem of a new workspace, the devfile must contain project info.
Prerequisites
- Your organization has a running instance of OpenShift Dev Spaces.
-
You know the FQDN URL of your organization’s OpenShift Dev Spaces instance:
https://<openshift_dev_spaces_fqdn>
.
Procedure
To start a new workspace from a devfile URL:
- Optional: Visit your OpenShift Dev Spaces dashboard pages to authenticate to your organization’s instance of OpenShift Dev Spaces.
Visit the URL to start a new workspace from a public repository using the basic syntax:
https://<openshift_dev_spaces_fqdn>#<devfile_url>
You can pass your personal access token to the URL to access a devfile from private repositories:
https://<openshift_dev_spaces_fqdn>#https://<token>@<host>/<path_to_devfile> 1
- 1
- Your personal access token that you generated on the Git provider’s website.
This works for GitHub, GitLab, Bitbucket, Microsoft Azure, and other providers that support Personal Access Token.
ImportantAutomated Git credential injection does not work in this case. To configure the Git credentials, use the configure personal access token guide.
TipYou can extend this URL with optional parameters:
https://<openshift_dev_spaces_fqdn>#<devfile_url>?<optional_parameters> 1
Example 1.7. A URL for starting a new workspace from a public repository
https://<openshift_dev_spaces_fqdn>#https://raw.githubusercontent.com/che-samples/cpp-hello-world/main/devfile.yaml
Example 1.8. A URL for starting a new workspace from a private repository
https://<openshift_dev_spaces_fqdn>#https://<token>@raw.githubusercontent.com/che-samples/cpp-hello-world/main/devfile.yaml
Verification
After you enter the URL to start a new workspace in a browser tab, the workspace starting page appears. When the new workspace is ready, the workspace IDE loads in the browser tab.
The workspace has a unique URL:
https://<openshift_dev_spaces_fqdn>/<user_name>/<unique_url>
.
Additional resources
1.3. Basic actions you can perform on a workspace
You manage your workspaces and verify their current states in the Workspaces page (https://<openshift_dev_spaces_fqdn>/dashboard/#/workspaces
) of your OpenShift Dev Spaces dashboard.
After you start a new workspace, you can perform the following actions on it in the Workspaces page:
Action | GUI steps in the Workspaces page |
---|---|
Reopen a running workspace | Click Open. |
Restart a running workspace | Go to ⋮ > Restart Workspace. |
Stop a running workspace | Go to ⋮ > Stop Workspace. |
Start a stopped workspace | Click Open. |
Delete a workspace | Go to ⋮ > Delete Workspace. |
1.4. Authenticating to a Git server from a workspace
In a workspace, you can run Git commands that require user authentication like cloning a remote private Git repository or pushing to a remote public or private Git repository.
User authentication to a Git server from a workspace is configured by the administrator or, in some cases, by the individual user:
- Your administrator sets up an OAuth application on GitHub, GitLab, Bitbucket, or Microsoft Azure Repos for your organization’s Red Hat OpenShift Dev Spaces instance.
- As a workaround, some users create and apply their own Kubernetes Secrets for their personal Git-provider access tokens or configure SSH keys for Git operations.