GitHub CEO Nat Friedman showed off Codespaces at the virtual Universe event, though the thing remains in limited preview and key features are still missing. Meanwhile, rival GitPod has added support for Visual Studio Code and the ability to run commands with root permissions in its similar workspace service.
Codespaces mean developers can run a containerised development environment from a web browser or from the Visual Studio code editor. GitHub users can run and debug code from anywhere, without needing to set up dependencies on their own machine, and from devices such as iPads, which do not support local development tools. The feature is free in preview, but will cost from $0.085 per hour when fully available.
Microsoft-owned GitHub introduced Codespaces in May, but elements were not altogether new. The containers run on the Azure cloud, and Microsoft already had a similar feature called Visual Studio Online, which was renamed to Visual Studio Codespaces shortly before the GitHub announcement. This created confusion. What was the difference between Visual Studio Codespaces and GitHub Codespaces, if any?
In September, Microsoft Program Manager Allison Buchholz-Au said what everyone was already thinking: that Visual Studio Codespaces would be dropped and that GitHub Codespaces is the future thing. Visual Studio Codespaces will be retired in February 2021.
There are a couple of snags. One is that there is no migration, developers have to recreate Codespaces. This might not too bad, since they are intended as transient environments. Second, the feature sets are not quite the same. "We are evaluating what makes sense to migrate" was the official word. One notable missing feature is support for Windows Codespaces: GitHub Codespaces only run Linux, whereas Visual Studio Codespaces also offered Windows, at least in preview.
Another key feature added to Visual Studio Codespaces in July is secrets support. Presume, for example, that an application in development must connect to a database. The database needs credentials. Hard-coding credentials in the code repository is a bad idea; it might seem OK in a private repository but it is a bad habit and a common source of credential leakage.
GitHub Codespaces currently lack this feature, though the plan is to use the same secrets management mechanism that exists for GitHub Actions, which can be per-repository or per-organisation. User-level secret management is a possibility too, and would be welcome. At the Universe gathering, the question was raised and the answer is that secrets management is coming soon – whatever that means.
Hitting a breakpoint in browser-hosted Visual Studio Code for an application running in a GitHub Codespace
We tried a Codespace in beta and it is somewhat magical, though takes a few minutes to spin up. Developers used to working with Visual Studio Code – the most popular code editor – will find it familiar and easy. The editor is automatically connected to the repository and you can edit code, commit code, run and debug in exactly the same way, all in the browser. The web application running in the Codespace is automatically port-forwarded to the developer's web browser. But our code ground to a halt when it tried to hit the database and threw an exception.
Maybe secrets management is one of the reasons Codespaces remains in preview, though we had half expected a general availability announcement at Universe. "When it's ready. We are working hard!!" said Friedman on Twitter. There are other features that remain high on developer wish-lists. The service is great for small repositories, but what about projects that span multiple repositories? Running and debugging large-scale projects introduces new issues for which Codespaces is not yet well suited.
In the meantime, GitPod came up with news of its own, timed to coincide with Universe. New features include the ability to run commands using sudo within a GitPod workspace, enabling things such as installing packages with apt-get; starting containers within a workspace (in preview); and support for Visual Studio Code in place of Eclipse Theia for the editor. GitPod has also introduced the ability to connect self-hosted GitLab applications with cloud-hosted GitPod, whereas previously it was cloud to cloud, or self-hosted to self-hosted.
GitPod's co-founder and CEO, Sven Efftinge, also claimed that Gitpod workspaces have other advantages, including being an open-source platform, offering more capable workspaces, and starting up faster. Incidentally, GitPod also supports secret management via user-specific environment variables.
Despite these GitPod advantages, the native GitHub Codespaces product will be welcome when it emerges from preview, thanks to its integration with the platform. The notion of an automated, code-defined development environment available on demand is compelling, and will be more so as these implementations mature. ®