BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News GitHub Codespaces Add Support for Microservices and Monorepo Projects

GitHub Codespaces Add Support for Microservices and Monorepo Projects

This item in japanese

Bookmarks

GitHub continues to extend its cloud-based development environment Codespaces, aiming to make it more flexible and increase developer productivity. Specifically, the latest release of Codespaces targets teams developing microservices or using a large monorepo.

After introducing prebuilt Codespaces to speed the time required to spin up a development environment, GitHub has been working to make Codespaces better suited to working with multi-repository and monorepo projects and make it easier for larger organization to adopt them.

The multi-repository scenario is typical of microservices, where each service is managed through its own repo:

When developing a feature that spans many of these services, you might want to clone and interact with each repository within your codespace.

Usually a codespace is created from a specific repository, to which it has access through a scoped token. In the past, if the developer needed to access additional repositories from within that codespace, for example to clone them or create pull requests, they were required to manually create additional personal access tokens.

Now, developers can simply specify which repositories a codespace is allowed to access and using which privilege level by editing the codespace devcontainer.json configuration file.

This is how you can add the my_org/my_repo repository to a codespace and grant it the privilege to create new issues:

{
  "customizations": {
    "codespaces": {
      "repositories": {
        "my_org/my_repo": {
          "permissions": {
            "issues": "write"
          }
        }
      }
    }
  }
}

You can also set permissions for all repos belonging to an organization by using a wildcard, e.g., "myorg/*" instead of "myorg/repo" in the example above. Similarly, you can grant all write permissions by using "permissions": { "write-all" }.

If you have configured additional repos in your codespace configuration, you will be prompted for authorization of the first launch of the codespace.

In the future, we plan to make it even simpler to work with microservices in Codespaces by automatically cloning across multiple services and allowing you to configure how your environment is initialized to run each repository.

Support for monorepos targets teams at the other end of the spectrum: instead of having one or more teams working with multiple intertwined repositories, you have multiple teams working with one large repo. In this case, each team may want to configure the codespace in a specific way.

To support this use case, GitHub Codespaces introduced the possibility to define multiple devcontainer.json files, each belonging to its own directory, e.g. .devcontainer/${DIR}/devcontainer.json.

If multiple configurations exist, users will be able to select their specific configuration at the time of codespace creation, allowing you to better customize your codespaces to fit the specific needs of your teams.

Another new feature aimed at bringing more flexibility to Codespaces is a new UI for advanced codespace creation, which allows developers to define a number of options when creating a codespace, including branch, region, machine type, and dev container configuration.

About the Author

Rate this Article

Adoption
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

BT