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.
The container
block specifies which Docker image of Qodana to pull.
The shellScript
block contains the qodana
command for running Qodana and enumerates the options that should be used during the run.
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.
Forward report to Qodana Cloud
Once you generated a project token in Qodana Cloud, 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.
Below is the script that lets you forward inspection reports to Qodana Cloud. It defines the QODANA_TOKEN
variable that refers to the qodana-token
secret.
The QODANA_REMOTE_URL
, QODANA_BRANCH
, and QODANA_REVISION
variables provide information about the repository URL, name of the inspected branch, and commit hash.
Combined configuration
This configuration script combines all approaches from this section.