Container IDE with cloud connection

Something for Everyone

GitHub Integration

As mentioned previously, you always launch the Gitpod IDE in the context of a GitHub project. However, the integration goes even further. Besides a project path, the Gitpod prefix or button also lets you open a file, an Issue , and a pull request.

In the first case, the Gitpod IDE opens the corresponding file in the editor. In the second case, Gitpod creates a local branch with the name GH-<Problemnumber>, in addition to preparing immediately a matching commit message. In the case of a pull request, Gitpod opens a view specially suited to code reviews.

Besides integration on a project-specific basis, Gitpod also supports working with the version control back end in various windows. Gitpod highlights changes, both in the Explorer by tagging directories and files with an M (for modified) (Figure 5) and in the code itself (for changed lines).

Figure 5: Git integration: The IDE highlights all code edits.

The Git view lists the modified files again. With the icons to the right of the files (Figure 6), you can run the usual Git operations (e.g., add or commit ). Of course, you can also do all of this at the command line in the terminal window.

Figure 6: Git operations on the interface.

Adjustments

Gitpod's standard workspace provides comprehensive support for multiple programming languages. Nevertheless, the referenced Docker image does not cover all needs. For example, in one of my projects, the python3-bottle package, which is missing in the Ubuntu environment of the standard workspace, was indispensable. In such a situation, you will have to manipulate Docker slightly and adapt the workspace. Simply reinstalling a package does not work because the default gitpod user in the workspace lacks root permissions.

The .gitpod.yml configuration file turns out to be the central element in such a scenario. It points to a Docker file, the official building instructions for the Docker image, and other configuration settings for the workspace (e.g., a command for calling Gitpod after creating the workspace).

A very minimal version of .gitpod.yml defines the Docker file for the project:

image:
 file: .gitpod.dockerfile

The project name can be freely selected, which allows for adjustments to the standard workspace, even without Docker skills and complicated hacks. One of the simplest steps is reinstalling project-specific packages:

FROM gitpod/workspace-full
RUN  sudo apt-get update && sudo apt-get install -y && python3-bottle && sudo rm -rf /var/lib/apt/lists/*

The first launch of a workspace with its own image takes a little longer, because Docker has to build the image first. If you use a public Docker image from Docker Hub instead of the standard image, you need to plan for additional time: The Gitpod infrastructure has to retrieve the base image from the Internet first.

Gitpod offers an additional GitHub app that immediately rebuilds the workspace in the background if changes are made to the project, thus saving valuable time at first launch. If you want to prepare your project for Gitpod in the best possible way, you should check out the Gitpod blog post about "Gitpodifying" [7].

Conclusions

Gitpod offers everything a developer needs for productive work: an editor, a command line, and a GitHub connection. All you have to do is register with the project once; you do not need to install any other software on your development machine.

However, this scenario only works in the online world. Gitpod can cope with brief interruptions, because the browser keeps the session alive, but offline work is not possible. If you want to program on the go, you need a good mobile network connection, or at least a rudimentary development environment. The combination of Git, VS Code, and Docker is an obvious choice.

The developers of Gitpod are constantly working on improvements. The current roadmap includes GitLab integration, editor plugins, and Gitpod Enterprise, a solution intended for corporations that want the benefits of Gitpod but do not want to entrust their source code and test data to a cloud system.

Infos

  1. Gitpod: https://www.gitpod.io
  2. Eclipse Theia: https://www.theia-ide.org
  3. GitHub: https://github.com
  4. GitLab: https://gitlab.com
  5. Gitpod documentation: https://www.gitpod.io/docs
  6. VS Code: https://code.visualstudio.com
  7. "Gitpodifying – The Ultimate Guide" by Jan Keromnes: https://www.gitpod.io/blog/gitpodify/

The Author

Bernhard Bablok, a long-time ADMIN author, works at Allianz Technology SE as a SAP HR developer. When he's not listening to music, cycling, or walking, he focuses on topics related to Linux, programming, and small-board computers. He can be reached by email at mailto:mail@bablokb.de.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus