Skip to content

Commit 41949df

Browse files
Add navbar, use markdown reference formating for links, fix misrendering alerts.
1 parent 596a1d1 commit 41949df

File tree

1 file changed

+40
-18
lines changed

1 file changed

+40
-18
lines changed

content/full-day/3-codespaces.md

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Cloud-based development with GitHub Codespaces
22

3-
One of the biggest challenges organizations face is onboarding new developers to projects. There are libraries to install, services to configure, version issues, obscure error messages... It can literally take days to get everything running before a developer is able to write their first line of code. [GitHub Codespaces](https://github.com/features/codespaces) is built to streamline this entire process. You can configure a container for development which your developers can access with just a couple of clicks from basically anywhere in the world. The container runs in the cloud, has everything already setup, and ready to go. Instead of days your developers can start writing code in seconds.
3+
| [← Project management with GitHub Issues][walkthrough-previous] | [Next: Continuous integration and testing →][walkthrough-next] |
4+
|:-----------------------------------|------------------------------------------:|
45

5-
GitHub Codespaces allows you to develop using the cloud-based container and Visual Studio Code in your browser window, meaning no local installation is required; you can do development with a tablet and a keyboard! You can also connect your local instance of [Visual Studio Code](https://docs.github.com/en/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code) or [JetBrains IDE](https://docs.github.com/en/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide)
6+
One of the biggest challenges organizations face is onboarding new developers to projects. There are libraries to install, services to configure, version issues, obscure error messages... It can literally take days to get everything running before a developer is able to write their first line of code. [GitHub Codespaces][codespaces] is built to streamline this entire process. You can configure a container for development which your developers can access with just a couple of clicks from basically anywhere in the world. The container runs in the cloud, has everything already setup, and ready to go. Instead of days your developers can start writing code in seconds.
7+
8+
GitHub Codespaces allows you to develop using the cloud-based container and Visual Studio Code in your browser window, meaning no local installation is required; you can do development with a tablet and a keyboard! You can also connect your local instance of [Visual Studio Code][vscode-codespaces] or [JetBrains IDE][jetbrains-codespaces]
69

710
Let's explore how to create and configure a codespaces for your project, and see how you can develop in your browser.
811

912
## Using the default container
1013

11-
GitHub provides a [default container](https://docs.github.com/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#using-the-default-dev-container-configuration) for all repositories. This container is based on a Linux image, and contains many popular runtimes including Node.js, Python, PHP and .NET. In many scenarios, this default container might be all you need. You also have the ability to configure a custom container for the repository, as you'll see later in this exercise. For now, let's explore how to use the default container.
14+
GitHub provides a [default container][github-universal-container] for all repositories. This container is based on a Linux image, and contains many popular runtimes including Node.js, Python, PHP and .NET. In many scenarios, this default container might be all you need. You also have the ability to configure a custom container for the repository, as you'll see later in this exercise. For now, let's explore how to use the default container.
1215

1316
1. If not already open, open your repository in your browser.
1417
1. From the **Code** tab (suggest to open a new browser tab) in your repo, access the green **<> Code** dropdown button and from the **Codespaces** tab click **Create codespace on main**.
1518
1. Allow the Codespace to load; it should take less than 30 seconds because we are using the default image.
1619

1720
## Defining a custom container
1821

19-
One thing that's really great is the [default dev container](https://github.com/devcontainers/images/blob/main/src/universal/.devcontainer/Dockerfile) has **.NET 7**, **node**, **python**, **mvn**, and more. But what if you need other tools? Or in our case, we want don't want to have each developer install the **[GitHub Copilot Extension](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot)**; we want to have everything pre-configured from the start!
22+
One thing that's really great is the [default dev container][github-universal-container-definition] has **.NET 7**, **node**, **python**, **mvn**, and more. But what if you need other tools? Or in our case, we want don't want to have each developer install the **[GitHub Copilot Extension][copilot-extension]**; we want to have everything pre-configured from the start!
2023

21-
Let's create our own dev container! The [dev container is configured](https://docs.github.com/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers) by creating the Docker files Codespaces will use to create and configure the container, and providing any customizations in the `devcontainer.json` file. Customizations provided in `devcontainer.json` can include ports to open, commands to run, and extension to install in Visual Studio Code (either running locally on the desktop or in the browser). This configuration becomes part of the repository. All developers who wish to contribute can then create a new instance of the container based on the configuration you provided.
24+
Let's create our own dev container! The [dev container is configured][dev-containers-docs] by creating the Docker files Codespaces will use to create and configure the container, and providing any customizations in the `devcontainer.json` file. Customizations provided in `devcontainer.json` can include ports to open, commands to run, and extension to install in Visual Studio Code (either running locally on the desktop or in the browser). This configuration becomes part of the repository. All developers who wish to contribute can then create a new instance of the container based on the configuration you provided.
2225

2326
1. Access the Command Palette (<kbd>F1</kbd> or clicking ☰ → View → Command Palette), then start typing **dev container**.
2427
2. Select **Codespaces: Add Development Container Configuration Files...** .
@@ -30,8 +33,8 @@ Let's create our own dev container! The [dev container is configured](https://do
3033
- **GitHub CLI**
3134
- **Python**
3235

33-
> [!NOTE]
34-
> You can type the name of the feature you want to filter the list.
36+
> [!NOTE]
37+
> You can type the name of the feature you want to filter the list.
3538
3639
7. Select **OK** to add the features.
3740
8. Select **Keep defaults** to use the default configuration.
@@ -44,7 +47,7 @@ You have now defined the container to be used by your codespace. This contains t
4447

4548
## Customize the extensions
4649

47-
Creating a development environment isn't solely focused on the services. Developers rely on various extensions and plugins for their [integrated development environments (IDEs)](https://en.wikipedia.org/wiki/Integrated_development_environment). To ensure consistency, you may want to define a set of extensions to automatically install. When using GitHub Codespaces and either a local instance of Visual Studio Code or the browser-based version, you can add a list of [extensions](https://code.visualstudio.com/docs/editor/extension-marketplace) to the **devcontainer.json** file.
50+
Creating a development environment isn't solely focused on the services. Developers rely on various extensions and plugins for their [integrated development environments (IDEs)][IDE]. To ensure consistency, you may want to define a set of extensions to automatically install. When using GitHub Codespaces and either a local instance of Visual Studio Code or the browser-based version, you can add a list of [extensions][vscode-extensions] to the **devcontainer.json** file.
4851

4952
Before rebuilding the container, let's add **GitHub.copilot** to the list of extensions.
5053

@@ -104,15 +107,16 @@ Whenever someone uses the codespace you defined they'll have an environment with
104107
1. Type **rebuild** and select **Codespaces: Rebuild container**.
105108
1. Select **Rebuild Container** on the dialog box. Your container now rebuilds.
106109

107-
> **IMPORTANT:** Rebuilding the container can take several minutes. Obviously this isn't an ideal situation for providing fast access to your developers, even if it's faster than creating everything from scratch. Fortunately you can [prebuild your codespaces](https://docs.github.com/en/codespaces/prebuilding-your-codespaces) to ensure developers can spin one up within seconds.
110+
> **IMPORTANT:** Rebuilding the container can take several minutes. Obviously this isn't an ideal situation for providing fast access to your developers, even if it's faster than creating everything from scratch. Fortunately you can [prebuild your codespaces][codespace-prebuild] to ensure developers can spin one up within seconds.
108111
>
109112
> You may also be prompted to reload the window as extensions install. Reload the window as prompted.
110113

111114
## Interacting with the repository
112115

113-
Custom containers for GitHub Codespaces become part of the source code for the repository. Thus they are maintained through standard source control, and will follow the repository as it's forked in the future. This allows this definition to be shared across all developers contributing to the project. Let's upload our new configuration, closing the [issue you created](./2-issues.md) for defining a development environment.
116+
Custom containers for GitHub Codespaces become part of the source code for the repository. Thus they are maintained through standard source control, and will follow the repository as it's forked in the future. This allows this definition to be shared across all developers contributing to the project. Let's upload our new configuration, closing the [issue you created][walkthrough-previous] for defining a development environment.
114117

115-
> **IMPORTANT:** For purposes of this exercise we are pushing code updates directly to `main`, our default branch. Normally you would follow the [GitHub flow](https://docs.github.com/en/get-started/quickstart/github-flow), which we will do in a [later exercise](6-github-flow.md).
118+
> [!IMPORTANT]
119+
> For purposes of this exercise we are pushing code updates directly to `main`, our default branch. Normally you would follow the [GitHub flow][github-flow], which we will do in a [later exercise][github-flow-exercise].
116120

117121
1. Open a new terminal window in the codespace by selecting <kbd>Ctl</kbd> + <kbd>Shift</kbd> + <kbd>`</kbd> or clicking ☰ → View → Terminal.
118122
1. Find the issue number for defining the codespace by entering the following command:
@@ -143,12 +147,30 @@ Custom containers for GitHub Codespaces become part of the source code for the r
143147

144148

145149
## Summary and next steps
146-
147-
Congratulations! You have now defined a custom development environment including all services and extensions. This eliminates the initial setup hurdle normally required when contributing to a project. Let's use this codespace to explore the code and [implement testing and continuous integration](./4-testing.md) for the project.
150+
Congratulations! You have now defined a custom development environment including all services and extensions. This eliminates the initial setup hurdle normally required when contributing to a project. Let's use this codespace to [implement testing and continuous integration][walkthrough-next] for the project.
148151

149152
## Resources
150-
151-
- [GitHub Codespaces](https://github.com/features/codespaces)
152-
- [Getting started with GitHub Codespaces](https://docs.github.com/en/codespaces/overview)
153-
- [Defining dev containers](https://docs.github.com/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers)
154-
- [GitHub Skills: Code with Codespaces](https://github.com/skills/code-with-codespaces)
153+
- [GitHub Codespaces][codespaces]
154+
- [Getting started with GitHub Codespaces][codespaces-docs]
155+
- [Defining dev containers][dev-containers-docs]
156+
- [GitHub Skills: Code with Codespaces][skills-codespaces]
157+
158+
| [← Project management with GitHub Issues][walkthrough-previous] | [Next: Continuous integration and testing →][walkthrough-next] |
159+
|:-----------------------------------|------------------------------------------:|
160+
161+
[codespaces]: https://github.com/features/codespaces
162+
[copilot-extension]: https://marketplace.visualstudio.com/items?itemName=GitHub.copilot
163+
[codespaces-docs]: https://docs.github.com/en/codespaces/overview
164+
[codespace-prebuild]: https://docs.github.com/en/codespaces/prebuilding-your-codespaces
165+
[dev-containers-docs]: https://docs.github.com/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers
166+
[github-flow]: https://docs.github.com/en/get-started/quickstart/github-flow
167+
[github-flow-exercise]: ./6-github-flow.md
168+
[github-universal-container]: https://docs.github.com/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers#using-the-default-dev-container-configuration
169+
[github-universal-container-definition]: https://github.com/devcontainers/images/blob/main/src/universal/.devcontainer/Dockerfile
170+
[IDE]: https://en.wikipedia.org/wiki/Integrated_development_environment
171+
[jetbrains-codespaces]: https://docs.github.com/en/codespaces/developing-in-codespaces/using-github-codespaces-in-your-jetbrains-ide
172+
[skills-codespaces]: https://github.com/skills/code-with-codespaces
173+
[vscode-codespaces]: https://docs.github.com/en/codespaces/developing-in-codespaces/using-github-codespaces-in-visual-studio-code
174+
[vscode-extensions]: https://code.visualstudio.com/docs/editor/extension-marketplace
175+
[walkthrough-previous]: 2-issues.md
176+
[walkthrough-next]: 4-testing.md

0 commit comments

Comments
 (0)