From d7528708f1e147d5c4a58223b00813dac2976ca6 Mon Sep 17 00:00:00 2001 From: Steve Guntrip <12534592+stevecat@users.noreply.github.com> Date: Wed, 28 Sep 2022 11:33:50 +0100 Subject: [PATCH 1/2] [Companion PR] Updates to tasklists early access docs (#31034) From 62c7f5b0a49cccf8c788e39c1bdce26bf3189812 Mon Sep 17 00:00:00 2001 From: Isaac Brown <101839405+isaacmbrown@users.noreply.github.com> Date: Wed, 28 Sep 2022 12:00:18 +0100 Subject: [PATCH 2/2] Document changing a codespace machine type with GitHub CLI (#31193) Co-authored-by: hubwriter --- ...ing-the-machine-type-for-your-codespace.md | 73 ++++++++++++++----- ...github-codespaces-in-visual-studio-code.md | 23 ++---- ...using-github-codespaces-with-github-cli.md | 11 ++- .../codespaces/about-changing-storage-size.md | 3 + .../changing-machine-type-in-vscode.md | 11 +++ 5 files changed, 85 insertions(+), 36 deletions(-) create mode 100644 data/reusables/codespaces/about-changing-storage-size.md create mode 100644 data/reusables/codespaces/changing-machine-type-in-vscode.md diff --git a/content/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace.md b/content/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace.md index 70b27849c78a..5aca361ee024 100644 --- a/content/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace.md +++ b/content/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace.md @@ -1,7 +1,7 @@ --- title: Changing the machine type for your codespace shortTitle: Change the machine type -intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for work you''re doing.' +intro: 'You can change the type of machine that''s running your codespace, so that you''re using resources appropriate for the work you''re doing.' product: '{% data reusables.gated-features.codespaces %}' versions: fpt: '*' @@ -23,9 +23,17 @@ type: how_to {% data reusables.codespaces.codespaces-machine-types %} You can choose an alternative machine type either when you create a codespace or at any time after you've created a codespace. -For information on choosing a machine type when you create a codespace, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace)." For information on changing the machine type within {% data variables.product.prodname_vscode %}, see "[Using {% data variables.product.prodname_github_codespaces %} in {% data variables.product.prodname_vscode %}](/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code#changing-the-machine-type-in-visual-studio-code)." +For information on choosing a machine type when you create a codespace, see "[Creating a codespace](/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace)." -## Changing the machine type in {% data variables.product.prodname_dotcom %} +## Changing the machine type + +{% note %} + +**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %} + +{% endnote %} + +{% webui %} {% data reusables.codespaces.your-codespaces-procedure-step %} @@ -37,33 +45,64 @@ For information on choosing a machine type when you create a codespace, see "[Cr 1. Click **Change machine type**. !['Change machine type' menu option](/assets/images/help/codespaces/change-machine-type-menu-option.png) - 1. If multiple machine types are available for your codespace, choose the type of machine you want to use. ![Dialog box showing available machine types to choose](/assets/images/help/codespaces/change-machine-type-choice.png) +1. Click **Update codespace**. + +{% endwebui %} + +{% vscode %} + +{% data reusables.codespaces.changing-machine-type-in-vscode %} + +{% endvscode %} + +{% cli %} + +You can use the `gh codespace edit --machine MACHINE-TYPE-NAME` {% data variables.product.prodname_cli %} command to change the machine type of a codespace. To use this command, you'll first need to find out the available machine types for your codespace. - {% note %} +1. To view your list of codespaces, in a terminal, enter the following command. + + ``` + gh codespace list + ``` +1. Optionally, to find the current machine type for a codespace, enter the following command. + + ``` + gh api /user/codespaces/CODESPACE-NAME + ``` - **Note**: {% data reusables.codespaces.codespaces-machine-type-availability %} + Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-myrepo-gmc7`. The permanent names are listed under the **NAME** column in the list returned by `gh codespace list`. - {% endnote %} + If you're prompted to request the `codespace` scope, follow the instructions in the terminal. -2. Click **Update codespace**. + Details for the current machine are listed under the `machine` field. +1. To find the available machine types for a codespace, enter the following command. + + ``` + gh api /user/codespaces/CODESPACE-NAME/machines + ``` - The change will take effect the next time your codespace restarts. + Replace `CODESPACE-NAME` with the permanent name of the codespace, for example `octocat-myrepo-gmc7`. +1. To change the machine type for a codespace, enter the following command. -## Force an immediate update of a currently running codespace + ``` + gh codespace edit --machine MACHINE-TYPE-NAME + ``` -If you change the machine type of a codespace you are currently using, and you want to apply the changes immediately, you can force the codespace to restart. + Replace `MACHINE-TYPE-NAME` with the name of an available machine type for your codespace, for example `standardLinux32gb`. +1. Using the arrow keys, navigate to the codespace you want to change, then press Enter. -1. At the bottom left of your codespace window, click **{% data variables.product.prodname_codespaces %}**. +{% endcli %} - ![Click '{% data variables.product.prodname_codespaces %}'](/assets/images/help/codespaces/codespaces-button.png) +{% data reusables.codespaces.about-changing-storage-size %} -1. From the options that are displayed at the top of the page select **Codespaces: Stop Current Codespace**. +{% cli %} - !['Suspend Current Codespace' option](/assets/images/help/codespaces/suspend-current-codespace.png) +## Further reading -1. After the codespace is stopped, click **Restart codespace**. +- "[Codespaces machines](/rest/codespaces/machines)" in the REST API documentation +- [`gh codespace edit`](https://cli.github.com/manual/gh_codespace_edit) in the {% data variables.product.prodname_cli %} manual - ![Click 'Resume'](/assets/images/help/codespaces/resume-codespace.png) +{% endcli %} \ No newline at end of file diff --git a/content/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code.md b/content/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code.md index 349ed58b1a01..1f866ccdd669 100644 --- a/content/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code.md +++ b/content/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code.md @@ -78,28 +78,15 @@ Use the {% data variables.product.prodname_vscode_marketplace %} to install the {% data reusables.codespaces.codespaces-machine-types %} You can change the machine type of your codespace at any time. -1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette (`shift command P` / `shift control P`). -1. Search for and select "Codespaces: Change Machine Type." +{% note %} - ![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-type-option.png) +**Note**: {% data reusables.codespaces.codespaces-machine-type-availability %} -1. Click the codespace that you want to change. +{% endnote %} - ![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-choose-repo.png) +{% data reusables.codespaces.changing-machine-type-in-vscode %} -1. Choose the machine type you want to use. - - {% note %} - - **Note**: {% data reusables.codespaces.codespaces-machine-type-availability %} - - {% endnote %} - -1. If the codespace is currently running, a message is displayed asking if you would like to restart and reconnect to your codespace now. - - Click **Yes** if you want to change the machine type used for this codespace immediately. - - If you click **No**, or if the codespace is not currently running, the change will take effect the next time the codespace restarts. +{% data reusables.codespaces.about-changing-storage-size %} ## Deleting a codespace in {% data variables.product.prodname_vscode_shortname %} diff --git a/content/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli.md b/content/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli.md index 36f08bad5842..0a582c1557e5 100644 --- a/content/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli.md +++ b/content/codespaces/developing-in-codespaces/using-github-codespaces-with-github-cli.md @@ -31,6 +31,7 @@ You can work with {% data variables.product.prodname_github_codespaces %} in the - [Modify ports in a codespace](#modify-ports-in-a-codespace) - [Access codespace logs](#access-codespace-logs) - [Access remote resources](#access-remote-resources) + - [Change the machine type of a codespace](#change-the-machine-type-of-a-codespace) ## Installing {% data variables.product.prodname_cli %} @@ -206,4 +207,12 @@ You can use the {% data variables.product.prodname_cli %} extension to create a **Note**: The {% data variables.product.prodname_cli %} extension is currently in beta and subject to change. -{% endnote %} \ No newline at end of file +{% endnote %} + +### Change the machine type of a codespace + +```shell +gh codespace edit -m machine-type-name +``` + +For more information, see the "{% data variables.product.prodname_cli %}" tab of "[Changing the machine type for your codespace](/codespaces/customizing-your-codespace/changing-the-machine-type-for-your-codespace)." \ No newline at end of file diff --git a/data/reusables/codespaces/about-changing-storage-size.md b/data/reusables/codespaces/about-changing-storage-size.md new file mode 100644 index 000000000000..65388779d3fc --- /dev/null +++ b/data/reusables/codespaces/about-changing-storage-size.md @@ -0,0 +1,3 @@ +If you changed to a virtual machine with a different storage capacity (for example, from 64GB to 32GB), your codespace will be unavailable for a short time while the machine type is changed. If the codespace is currently active, it will automatically be stopped. When the change is complete, you'll be able to restart the codespace running on the new machine type. + +If you changed to a virtual machine with the same storage capacity, the change will be applied the next time you restart the codespace. An active codespace will not be stopped automatically. For more information on restarting a codespace, see "[Stopping and starting a codespace](/codespaces/developing-in-codespaces/stopping-and-starting-a-codespace#restarting-a-codespace)." \ No newline at end of file diff --git a/data/reusables/codespaces/changing-machine-type-in-vscode.md b/data/reusables/codespaces/changing-machine-type-in-vscode.md new file mode 100644 index 000000000000..c7ca3fff29e9 --- /dev/null +++ b/data/reusables/codespaces/changing-machine-type-in-vscode.md @@ -0,0 +1,11 @@ +1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette with Command+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux). +1. Search for and select "Codespaces: Change Machine Type." + + ![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-type-option.png) +1. If you're not following these instructions within a codespace, click the codespace that you want to change. + + ![Searching for a branch to create a new {% data variables.product.prodname_codespaces %}](/assets/images/help/codespaces/vscode-change-machine-choose-repo.png) + + If you are following these instructions in a codespace, the change will apply to the codespace you're working in. +1. Select the machine type you want to use. +1. If you're changing to a machine type with a different storage capacity, a prompt will appear asking if you would like to continue. Read the prompt and click **Yes** to accept. \ No newline at end of file