diff --git a/assets/images/help/codespaces/add-constraint-dropdown-ports.png b/assets/images/help/codespaces/add-constraint-dropdown-ports.png index 789c4b5109..a792d445ce 100644 Binary files a/assets/images/help/codespaces/add-constraint-dropdown-ports.png and b/assets/images/help/codespaces/add-constraint-dropdown-ports.png differ diff --git a/assets/images/help/codespaces/add-constraint-dropdown-timeout.png b/assets/images/help/codespaces/add-constraint-dropdown-timeout.png new file mode 100644 index 0000000000..773b9c4358 Binary files /dev/null and b/assets/images/help/codespaces/add-constraint-dropdown-timeout.png differ diff --git a/assets/images/help/codespaces/add-constraint-dropdown.png b/assets/images/help/codespaces/add-constraint-dropdown.png index 1839b2fc54..2baa3aa8d1 100644 Binary files a/assets/images/help/codespaces/add-constraint-dropdown.png and b/assets/images/help/codespaces/add-constraint-dropdown.png differ diff --git a/assets/images/help/codespaces/edit-timeout-constraint.png b/assets/images/help/codespaces/edit-timeout-constraint.png new file mode 100644 index 0000000000..a5056f7437 Binary files /dev/null and b/assets/images/help/codespaces/edit-timeout-constraint.png differ diff --git a/assets/images/help/codespaces/maximum-minutes-timeout.png b/assets/images/help/codespaces/maximum-minutes-timeout.png new file mode 100644 index 0000000000..0b7b33fe4f Binary files /dev/null and b/assets/images/help/codespaces/maximum-minutes-timeout.png differ diff --git a/content/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces.md b/content/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces.md index 16271c4c7c..0e53f35f94 100644 --- a/content/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces.md +++ b/content/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces.md @@ -12,6 +12,8 @@ shortTitle: Set the timeout A codespace will stop running after a period of inactivity. You can specify the length of this timeout period. The updated setting will apply to any newly created codespace. +Some organizations may have a maximum idle timeout policy. If an organization policy sets a maximum timeout which is less than the default timeout you have set, the organization's timeout will be used instead of your setting, and you will be notified of this after the codespace is created. For more information, see "[Restricting the idle timeout period](/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)." + {% warning %} **Warning**: Codespaces are billed per minute. If you are not actively using a codespace but the codespace has not yet timed out, you are still billed for the time that the codespace is running. For more information, see "[About billing for Codespaces](/billing/managing-billing-for-github-codespaces/about-billing-for-codespaces#codespaces-pricing)." diff --git a/content/codespaces/managing-codespaces-for-your-organization/index.md b/content/codespaces/managing-codespaces-for-your-organization/index.md index 311c0b03c1..a906ea1613 100644 --- a/content/codespaces/managing-codespaces-for-your-organization/index.md +++ b/content/codespaces/managing-codespaces-for-your-organization/index.md @@ -15,6 +15,7 @@ children: - /reviewing-your-organizations-audit-logs-for-codespaces - /restricting-access-to-machine-types - /restricting-the-visibility-of-forwarded-ports + - /restricting-the-idle-timeout-period shortTitle: Managing your organization --- diff --git a/content/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types.md b/content/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types.md index 8b80ce1110..262e356909 100644 --- a/content/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types.md +++ b/content/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types.md @@ -1,9 +1,9 @@ --- title: Restricting access to machine types -shortTitle: Machine type access +shortTitle: Restrict machine types intro: You can set constraints on the types of machines users can choose when they create codespaces in your organization. product: '{% data reusables.gated-features.codespaces %}' -permissions: 'To manage access to machine types for the repositories in an organization, you must be an organization owner.' +permissions: 'To manage access to machine types for the repositories in an organization, you must be an owner of the organization.' versions: fpt: '*' ghec: '*' @@ -48,32 +48,34 @@ If you add an organization-wide policy, you should set it to the largest choice {% data reusables.profile.access_org %} {% data reusables.profile.org_settings %} 1. In the "Code, planning, and automation" section of the sidebar, select **{% octicon "codespaces" aria-label="The codespaces icon" %} {% data variables.product.prodname_codespaces %}** then click **Policy**. -2. On the "Codespace policies" page, click **Create Policy**. -3. Enter a name for your new policy. -4. Click **Add constraint** and choose **Machine types**. +1. On the "Codespace policies" page, click **Create Policy**. +1. Enter a name for your new policy. +1. Click **Add constraint** and choose **Machine types**. ![Add a constraint for machine types](/assets/images/help/codespaces/add-constraint-dropdown.png) -5. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint, then clear the selection of any machine types that you don't want to be available. +1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint, then clear the selection of any machine types that you don't want to be available. ![Edit the machine type constraint](/assets/images/help/codespaces/edit-machine-constraint.png) -6. In the "Change policy target" area, click the dropdown button. -7. Choose either **All repositories** or **Selected repositories** to determine which repositories this policy will apply to. -8. If you chose **Selected repositories**: +1. In the "Change policy target" area, click the dropdown button. +1. Choose either **All repositories** or **Selected repositories** to determine which repositories this policy will apply to. +1. If you chose **Selected repositories**: 1. Click {% octicon "gear" aria-label="The settings icon" %}. ![Edit the settings for the policy](/assets/images/help/codespaces/policy-edit.png) - 2. Select the repositories you want this policy to apply to. - 3. At the bottom of the repository list, click **Select repositories**. + 1. Select the repositories you want this policy to apply to. + 1. At the bottom of the repository list, click **Select repositories**. ![Select repositories for this policy](/assets/images/help/codespaces/policy-select-repos.png) -9. Click **Save**. - +1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see "[Restricting the visibility of forwarded ports](http://localhost:4000/en/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)" and "[Restricting the idle timeout period](http://localhost:4000/en/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)." +1. After you have finished adding constraints to your policy, click **Save**. ## Editing a policy +You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy. + 1. Display the "Codespace policies" page. For more information, see "[Adding a policy to limit the available machine types](#adding-a-policy-to-limit-the-available-machine-types)." 1. Click the name of the policy you want to edit. 1. Make the required changes then click **Save**. diff --git a/content/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period.md b/content/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period.md new file mode 100644 index 0000000000..1833e1a2c5 --- /dev/null +++ b/content/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period.md @@ -0,0 +1,90 @@ +--- +title: Restricting the idle timeout period +shortTitle: Restrict timeout periods +intro: 'You can set a maximum timeout period for any codespaces owned by your organization.' +product: '{% data reusables.gated-features.codespaces %}' +permissions: 'To manage timeout constraints for an organization''s codespaces, you must be an owner of the organization.' +versions: + fpt: '*' + ghec: '*' +type: how_to +topics: + - Codespaces +--- + +## Overview + +The personal settings of a {% data variables.product.prodname_dotcom %} user allow them to define how long a codespace they have created can remain inactive before it times out. When a codespace times out it is stopped and will no longer incur charges for compute usage. For more information, see "[Setting your timeout period for Codespaces](/codespaces/customizing-your-codespace/setting-your-timeout-period-for-codespaces)." + +As an organization owner, you may want to configure constraints on the maximum idle timeout period for codespaces owned by your organization. This can help you limit costs associated with codespaces that are left to timeout after long periods of inactivity. You can set a maximum timeout for all codespaces owned by your organization, or for the codespaces of specific repositories. + +{% note %} + +**Note**: Maximum idle timeout constraints only apply to codespaces that are owned by your organization. They do not apply to codespaces for which the organization is not the billable owner. + +{% endnote %} + +For more information about pricing for {% data variables.product.prodname_codespaces %} compute usage, see "[About billing for Codespaces](/billing/managing-billing-for-github-codespaces/about-billing-for-codespaces#codespaces-pricing)." + +### Behavior when you set a maximum idle timeout constraint + +If someone sets the default idle timeout to 90 minutes in their personal settings and they then start a codespace for a repository with a maximum idle timeout constraint of 60 minutes, the codespace will time out after 60 minutes of inactivity. When codespace creation completes, a message explaining this will be displayed: + +> Idle timeout for this codespace is set to 60 minutes in compliance with your organization’s policy. + +### Setting organization-wide and repository-specific policies + +When you create a policy you choose whether it applies to all repositories in your organization, or only to specified repositories. If you create an organization-wide policy with a timeout constraint then the timeout constraints in any repository-specific policies must fall within the restriction set at the organization level. The shortest timeout period, in an organization policy, a repository policy, or in someone's personal settings, is applied. + +If you add an organization-wide policy with a timeout constraint, you should set the timeout to the longest acceptable period. You can then add repository-specific policies that set the maximum timeout to a shorter period. + +## Adding a policy to set a maximum idle timeout period + +{% data reusables.profile.access_org %} +{% data reusables.profile.org_settings %} +1. In the "Code, planning, and automation" section of the sidebar, select **{% octicon "codespaces" aria-label="The codespaces icon" %} {% data variables.product.prodname_codespaces %}** then click **Policies**. +1. On the "Codespace policies" page, click **Create Policy**. +1. Enter a name for your new policy. +1. Click **Add constraint** and choose **Maximum idle timeout**. + + ![Add a constraint for idle timeout](/assets/images/help/codespaces/add-constraint-dropdown-timeout.png) + +1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint. + + ![Edit the timeout constraint](/assets/images/help/codespaces/edit-timeout-constraint.png) + +1. Enter the maximum number of minutes codespaces can remain inactive before they time out, then click **Save**. + + ![Choose the port visibility options](/assets/images/help/codespaces/maximum-minutes-timeout.png) + +1. In the "Change policy target" area, click the dropdown button. +1. Choose either **All repositories** or **Selected repositories** to determine which repositories this policy will apply to. +1. If you chose **Selected repositories**: + 1. Click {% octicon "gear" aria-label="The settings icon" %}. + + ![Edit the settings for the policy](/assets/images/help/codespaces/policy-edit.png) + + 2. Select the repositories you want this policy to apply to. + 3. At the bottom of the repository list, click **Select repositories**. + + ![Select repositories for this policy](/assets/images/help/codespaces/policy-select-repos.png) + +1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see "[Restricting access to machine types](http://localhost:4000/en/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)" and "[Restricting the visibility of forwarded ports](http://localhost:4000/en/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports)." +1. After you have finished adding constraints to your policy, click **Save**. + +The policy will be applied to all new codespaces and to existing codespaces the next time they are started. + +## Editing a policy + +You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy. + +1. Display the "Codespace policies" page. For more information, see "[Adding a policy to set a maximum idle timeout period](#adding-a-policy-to-set-a-maximum-idle-timeout-period)." +1. Click the name of the policy you want to edit. +1. Make the required changes then click **Save**. + +## Deleting a policy + +1. Display the "Codespace policies" page. For more information, see "[Adding a policy to set a maximum idle timeout period](#adding-a-policy-to-set-a-maximum-idle-timeout-period)." +1. Click the delete button to the right of the policy you want to delete. + + ![The delete button for a policy](/assets/images/help/codespaces/policy-delete.png) diff --git a/content/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports.md b/content/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports.md index 066f0fccc0..b32219293a 100644 --- a/content/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports.md +++ b/content/codespaces/managing-codespaces-for-your-organization/restricting-the-visibility-of-forwarded-ports.md @@ -1,9 +1,9 @@ --- title: Restricting the visibility of forwarded ports -shortTitle: Restricting port visibility +shortTitle: Restrict port visibility intro: 'You can set constraints on the visibility options users can choose when they forward ports from codespaces in your organization.' product: '{% data reusables.gated-features.codespaces %}' -permissions: 'To manage access to port visibility constraints for the repositories in an organization, you must be an organization owner.' +permissions: 'To manage access to port visibility constraints for the repositories in an organization, you must be an owner of the organization.' versions: fpt: '*' ghec: '*' @@ -47,7 +47,7 @@ If you add an organization-wide policy, you should set it to the most lenient vi ![Add a constraint for port visibility](/assets/images/help/codespaces/add-constraint-dropdown-ports.png) -1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint +1. Click {% octicon "pencil" aria-label="The edit icon" %} to edit the constraint. ![Edit the port visibility constraint](/assets/images/help/codespaces/edit-port-visibility-constraint.png) @@ -67,10 +67,12 @@ If you add an organization-wide policy, you should set it to the most lenient vi ![Select repositories for this policy](/assets/images/help/codespaces/policy-select-repos.png) -1. Click **Save**. - +1. If you want to add another constraint to the policy, click **Add constraint** and choose another constraint. For information about other constraints, see "[Restricting access to machine types](http://localhost:4000/en/codespaces/managing-codespaces-for-your-organization/restricting-access-to-machine-types)" and "[Restricting the idle timeout period](http://localhost:4000/en/codespaces/managing-codespaces-for-your-organization/restricting-the-idle-timeout-period)." +1. After you have finished adding constraints to your policy, click **Save**. ## Editing a policy +You can edit an existing policy. For example, you may want to add or remove constraints to or from a policy. + 1. Display the "Codespace policies" page. For more information, see "[Adding a policy to limit the port visibility options](#adding-a-policy-to-limit-the-port-visibility-options)." 1. Click the name of the policy you want to edit. 1. Make the required changes then click **Save**.