How to Configure CI/CD for JetBrains Space
JetBrains Space is a full-cycle collaboration solution for software development teams. This guide explains how to achieve continuous integration and delivery of JetBrains Space projects by integrating them with TeamCity.
Integration with TeamCity brings the following advantages to the JetBrains Space users:
This guide consists of the common preliminary setup and optional procedures for enabling each component of the integration.
To perform all the steps described in this guide, you need to have:
Project administration rights in the JetBrains Space instance of your organization.
To enable authentication via JetBrains Space in TeamCity, system administration rights in TeamCity.
Connecting TeamCity to JetBrains Space involves two steps: (1) creating a service application for TeamCity authentication in your Space instance and (2) creating a preset of connection to Space.
Step 1: Create Application in JetBrains Space
In your JetBrains Space instance:
Go to Administration | Applications and click New application.
Enter a convenient name (for example,
Space-to-TeamCity), save the application, and click Go to application settings.
Configure In-context Authorization:
On the Authorization tab, click Authorize in new context.
Enter the name of the Space project you are about to access from TeamCity and click Authorize.
(Optional) If you want TeamCity to be able to publish commit statuses to Space, you will need to add a respective permission.
Click Configure and enable Git Repositories | Report external check status. This request has to be accepted by the project administrator.
Configure Global Authorization:
On the Authorization tab, click Configure.
To establish general access from TeamCity to Space, enable the Members | View member profile permission and click Save. This request has to be accepted by the server administrator.
Configure Authentication Mode:
Go back to the app's Overview and open the Authentication tab.
To be able to use authentication via Space in TeamCity or/and to create projects/configurations from Space repositories, enable Authorization Code Flow as well. Enter the redirect URI (
https://<server>:<port>/oauth/space/accessToken.html) of your TeamCity Server.
Copy the app's Client ID and Client secret. You will need them for configuration on the TeamCity side.
Now, you can return to TeamCity and add a connection to JetBrains Space.
Step 2: Establish Connection to JetBrains Space
To create a connection to your JetBrains Space instance:
Go to Project Settings | Connections and click Add Сonnection.
Choose the JetBrains Space connection type.
Enter the settings as follows:
Space URL: the URL of your Space instance (
Client ID: the client ID value copied from the Space app's Authentication tab.
Client secret: the client secret value copied from the Space app's Authentication tab.
Save the connection.
At this stage, you are free to access your JetBrains Space instance from the current project or any of its subprojects whenever necessary.
Connecting TeamCity Projects with JetBrains Space Projects
There are three ways to integrate a VCS repository with TeamCity:
Create a TeamCity project based on a repository.
Create a build configuration based on a repository in an existing TeamCity project.
Create a VCS root based on a repository in an existing TeamCity project.
We will describe the first approach as it's the most popular and self-sufficient. However, you can always add one more Space root or build configuration to an existing project — the procedure is similar.
Let's create a subproject of the project where you added the Space connection during the preliminary setup. If it is the Root project, go to Administration | Projects and click Create project there.
You will notice the new button: From JetBrains Space. Its name depends on the Display name you gave to the connection, but you can always distinguish Space connections from others by the Space logo. To create a new project:
Click From JetBrains Space.
As it is the first time you connect this server to your Space instance, you have to authenticate in Space via your user profile. Click Sign in to Space and accept the access request. Next time, you won't have to confirm it again, unless you sign out or change your password.
The project creation wizard will display a list of all Space projects your user has access to. Choose a repository and wait until TeamCity verifies the connection settings.
Now it's time to configure the main settings of the new project and its VCS root. You can always adjust them later.
Project name and the name of its first build configuration.
VCS root: (read-only) matches the URL of a repository you choose in Step 3.
refs/heads/main, or another branch of your choice. Remember to keep
refs/headsand change only the branch name.
Branch specification: if you want to run builds on other branches apart from the default one, this setting allows extending the scope of the VCS root to monitor these branches as well. TeamCity uses a special format or branch specification rules for this. To monitor the whole repository, use the
TeamCity will attempt to autodetect build steps in your project. You can confirm or reject the proposed steps and explore the project settings further.
If you create a project from a repository automatically, like we just did, TeamCity automatically adds a VCS trigger. This trigger will be watching your Space repository and run builds on each new commit. You can edit its settings or add other types of triggers.
TeamCity will show the commits that got into a build on the build's Overview tab. Click the Space icon opposite a commit to open its details in JetBrains Space:
After this basic setup, you can advance the Space integration by following the instructions below, or learn how to create more sophisticated build configurations and utilize the power of TeamCity to the fullest.
Reporting Build Statuses to JetBrains Space
TeamCity can report statuses of builds to JetBrains Space. To achieve this:
Go to Build Configuration Settings | Build Features.
Click Add build feature and choose Commit Status Publisher.
Select the JetBrains Space publisher and the connection to Space.
Specify the name that will be displayed for this service in Space.
Save the settings.
Now, whenever you run a build in this configuration, TeamCity will report the build status to JetBrains Space.
Authenticating in TeamCity with JetBrains Space Account
Users of your JetBrains Space instance can authenticate in TeamCity with their Space accounts. Note that this functionality requires adding the JetBrains Space connection on the Root project level.
To configure it:
Go to Administration | Authentication.
Click Add module and choose the JetBrains Space type.
Choose if you want to allow creating new users on the first login, if their emails are not recognized by TeamCity. Disabling this option could be helpful if you use a publicly available TeamCity server and want to limit access to it.
Save the module.
To sign in to TeamCity, click the JetBrains Space icon above the TeamCity login form and, after the redirect, approve the TeamCity request.