Space Automation
Space Automation is a CI/CD tool that helps you automate development workflows in the JetBrains Space environment. This section explains how you can configure and run Qodana Docker images within Space Automation jobs.
Prepare your project
Assuming that your JetBrains Space account already has a project and a repository, in the project root create the .space.kts
file. This file will contain configuration scripts written in Kotlin and mentioned in this section.
Basic configuration
This is the basic configuration script for running Qodana in JetBrains Automation jobs.
The container
block specifies which Docker image of Qodana to run.
The QODANA_TOKEN
variable refers to the project token generated in Qodana Cloud and contained in the qodana-token
secret. This token is required by the paid Qodana linters, and is optional for using with the Community linters. You can see these sections to learn how to generate the project token:
The Onboarding section explains how to get the project token generated while first working with Qodana Cloud
The Manage a project section explains how to create a project in the existing Qodana Cloud organization
Once the project token is generated, in the Settings section of your JetBrains Space environment create a secret with the qodana-token
name. Save the project token as the value for this secret.
The shellScript
block contains the qodana
command for running Qodana, and it can also contain the options that can be used during the run like quality gate or baseline.
Inspect specific branches
The startOn
block lets you specify the event that will trigger a job. This configuration uses the nested branchFilter
block to override the default trigger and run the job only after changes made in the feature
branch.
The codeReviewOpened
trigger lets you inspect code reviews opened in the default branch of the project.
Quality gate and baseline
You can use the --fail-threshold <number>
and --baseline <path/to/qodana.sarif.json>
lines in the shellScript
block to invoke the quality gate and baseline features.