-
Notifications
You must be signed in to change notification settings - Fork 172
docs: default extension in visual studio code #2819
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
87dde96
docs: default extension in visual studio code
vitaliy-guliy 196dfd9
docs: default extension in visual studio code
vitaliy-guliy 9813b95
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 8733569
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 70d1e5a
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy d65da71
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 42f8bea
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy e4e3e30
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 692ffb8
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 159f974
Apply suggestions from code review
vitaliy-guliy 6750ee2
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 2c63de4
docs: default extension in visual studio code
vitaliy-guliy 414a57b
docs: highlight samples with border
vitaliy-guliy b18352c
Update modules/administration-guide/pages/default-extensions-for-micr…
vitaliy-guliy 5d0d01b
Apply suggestions from code review
vitaliy-guliy 723ef3e
Apply formatting
vitaliy-guliy 020c358
Apply suggestions from code review
vitaliy-guliy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
176 changes: 176 additions & 0 deletions
176
...nistration-guide/pages/default-extensions-for-microsoft-visual-studio-code.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,176 @@ | ||
| :_content-type: PROCEDURE | ||
| :description: Configure default extensions | ||
| :keywords: extensions, workspace | ||
| :navtitle: Configure default extensions | ||
| // :page-aliases: | ||
|
|
||
| [id="visual-studio-code-default-extensions"] | ||
| = Configuring default extensions | ||
|
|
||
| Default extensions are a pre-installed set of extensions, specified by putting the extension binary `.vsix` file path to the __DEFAULT_EXTENSIONS__ environment variable. | ||
|
|
||
| After startup, the editor checks for this environment variable, and if it is specified, takes the path to the extensions and installs it in the background without disturbing the user. | ||
|
|
||
| Configuring default extensions is useful for installing .vsix extensions from the editor level. | ||
|
|
||
| [NOTE] | ||
| ==== | ||
| If you want to specify multiple extensions, separate them by semicolon. | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| DEFAULT_EXTENSIONS='/projects/extension-1.vsix;/projects/extension-2.vsix' | ||
| ---- | ||
| ==== | ||
|
|
||
| Read on to learn how to define the DEFAULT_EXTENSIONS environment variable, including multiple examples of adding `.vsix` files to your workspace. | ||
|
|
||
| There are three different ways to embed default `.vsix` extensions into your workspace: | ||
|
|
||
| * Put the extension binary into the source repository. | ||
| * Use the devfile `postStart` event to fetch extension binaries from the network. | ||
| * Include the extensions' `.vsix` binaries in the `che-code` image. | ||
|
|
||
| .Putting the extension binary into the source repository | ||
|
|
||
| Putting the extension binary into the Git repository and defining the environment variable in the devfile is the easiest way to add default extensions to your workspace. | ||
| If the `extension.vsix` file exists in the repository root, you can set the __DEFAULT_EXTENSIONS__ for a tooling container. | ||
|
|
||
| .Procedure | ||
| * Specify __DEFAULT_EXTENSIONS__ in your `.devfile.yaml` as shown in the following example: | ||
| + | ||
| ==== | ||
| [source,yaml] | ||
| ---- | ||
| schemaVersion: 2.3.0 | ||
| metadata: | ||
| generateName: example-project | ||
| components: | ||
| - name: tools | ||
| container: | ||
| image: quay.io/devfile/universal-developer-image:ubi8-latest | ||
| env: | ||
| - name: 'DEFAULT_EXTENSIONS' | ||
| value: '/projects/example-project/extension.vsix' | ||
| ---- | ||
| ==== | ||
|
|
||
| .Using the devfile *postStart* event to fetch extension binaries from the network | ||
|
|
||
| You can use cURL or GNU Wget to download extensions to your workspace. | ||
| For that you need to: | ||
|
|
||
| -- | ||
| * specify a devfile command to download extensions to your workpace | ||
| * add a `postStart` event to run the command on workspace startup | ||
| * define the __DEFAULT_EXTENSIONS__ environment variable in the devfile | ||
| -- | ||
|
|
||
| .Procedure | ||
| * Add the values shown in the following example to the devfile: | ||
| + | ||
| ==== | ||
| [source,yaml] | ||
| ---- | ||
| schemaVersion: 2.3.0 | ||
| metadata: | ||
| generateName: example-project | ||
| components: | ||
| - name: tools | ||
| container: | ||
| image: quay.io/devfile/universal-developer-image:ubi8-latest | ||
| env: | ||
| - name: DEFAULT_EXTENSIONS | ||
| value: '/tmp/extension-1.vsix;/tmp/extension-2.vsix' | ||
|
|
||
| commands: | ||
| - id: add-default-extensions | ||
| exec: | ||
| # name of the tooling container | ||
| component: tools | ||
| # download several extensions using curl | ||
| commandLine: | | ||
| curl https://.../extension-1.vsix --location -o /tmp/extension-1.vsix | ||
| curl https://.../extension-2.vsix --location -o /tmp/extension-2.vsix | ||
|
|
||
| events: | ||
| postStart: | ||
| - add-default-extensions | ||
vitaliy-guliy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ---- | ||
| ==== | ||
| + | ||
| [WARNING] | ||
| ==== | ||
| In some cases curl may download a `.gzip` compressed file. This might make installing the extension impossible. | ||
| To fix that try to save the file as a *.vsix.gz* file and then decompress it with *gunzip*. This will replace the *.vsix.gz* file with an unpacked *.vsix* file. | ||
|
|
||
| [source,yaml] | ||
| ---- | ||
| curl https://some-extension-url --location -o /tmp/extension.vsix.gz | ||
| gunzip /tmp/extension.vsix.gz | ||
| ---- | ||
| ==== | ||
|
|
||
| .Including the extensions `.vsix` binaries in the `che-code` image. | ||
|
|
||
| With default extensions bundled in the editor image, and the __DEFAULT_EXTENSIONS__ environment variable defined in the ConfigMap, you can apply the default extensions without changing the devfile. | ||
|
|
||
| Following the steps below to add the extensions you need to the editor image. | ||
|
|
||
| .Procedure | ||
| * Create a directory and place your selected `.vsix` extensions in this directory. | ||
|
|
||
| * Create a Dockerfile with the following content: | ||
| + | ||
| ==== | ||
| [source,] | ||
| ---- | ||
| # inherit che-incubator/che-code:latest | ||
| FROM quay.io/che-incubator/che-code:latest | ||
| USER 0 | ||
|
|
||
| # copy all .vsix files to /default-extensions directory | ||
| RUN mkdir --mode=775 /default-extensions | ||
| COPY --chmod=755 *.vsix /default-extensions/ | ||
|
|
||
| # add instruction to the script to copy default extensions to the working container | ||
| RUN echo "cp -r /default-extensions /checode/" >> /entrypoint-init-container.sh | ||
| ---- | ||
| ==== | ||
|
|
||
| * Build the image and then push it to a registry: | ||
| + | ||
| ==== | ||
| [,console] | ||
| ---- | ||
| $ docker build -t yourname/che-code:next . | ||
| $ docker push yourname/che-code:next | ||
| ---- | ||
| ==== | ||
|
|
||
| * Add the new ConfigMap to the user's {orch-namespace}, define the __DEFAULT_EXTENSIONS__ environment variable, and specify the absolute paths to the extensions. This ConfigMap sets the environment variable to all workspaces in the user's {orch-namespace}. | ||
| + | ||
| ==== | ||
| [source,yaml] | ||
| ---- | ||
| kind: ConfigMap | ||
| apiVersion: v1 | ||
| metadata: | ||
| name: vscode-default-extensions | ||
| labels: | ||
| controller.devfile.io/mount-to-devworkspace: 'true' | ||
| controller.devfile.io/watch-configmap: 'true' | ||
| annotations: | ||
| controller.devfile.io/mount-as: env | ||
| data: | ||
| DEFAULT_EXTENSIONS: '/checode/default-extensions/extension1.vsix;/checode/default-extensions/extension2.vsix' | ||
| ---- | ||
vitaliy-guliy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ==== | ||
|
|
||
| * Create a workspace using `yourname/che-code:next` image. | ||
| First, open the dashboard and navigate to the *Create Workspace* tab on the left side. | ||
| + | ||
| -- | ||
| .. In the *Editor Selector* section, expand the *Use an Editor Definition* dropdown and set the editor URI to the *Editor Image*. | ||
| .. Create a workspace by clicking on any sample or by using a Git repository URL. | ||
| -- | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.