Qodana 2022.1 Help

GitLab CI/CD

Basic Example

To add a Qodana runner to a GitLab CI/CD pipeline, use the following configuration sample: (.gitlab-ci.yml):

qodana: image: name: jetbrains/qodana-<linter> entrypoint: [''] script: - /opt/idea/bin/entrypoint --results-dir=$CI_PROJECT_DIR/qodana --save-report --report-dir=$CI_PROJECT_DIR/qodana/report artifacts: paths: - qodana

Exposing a Qodana report

To make a report available in any given merge request, you can use the expose_as keyword and change the path to the artifacts (.gitlab-ci.yml):

qodana: image: name: jetbrains/qodana-<linter> entrypoint: [''] script: - /opt/idea/bin/entrypoint --results-dir=$CI_PROJECT_DIR/qodana --save-report --report-dir=$CI_PROJECT_DIR/qodana/report artifacts: paths: - qodana/report/ expose_as: 'Qodana report'

Assuming that you have configured your pipeline in a similar manner, this is what it may look like:

  1. Qodana report affiliated with a pipeline in a merge request

    Qodana report affiliated with a pipeline in a merge request
  2. Available actions for a given exposed Qodana artifact

    Available actions for a given exposed Qodana artifact

Consider using a fail threshold to make the build fail when a certain number of problems is reached, and baseline mode, in which each new Qodana run is compared to some initial run selected as a "baseline". Running as non-root is also supported.

Last modified: 20 May 2022