Add Qodana to your CI pipeline
Qodana provides solutions for various CI systems; several of them are implemented as native solutions, while for several others you can run Docker images of Qodana, see the table below:
Native solutions | |
|---|---|
This section shows how you can configure Qodana for GitHub Actions and Jenkins pipelines. The complete guides for other CI systems including basic configuration examples are available in the Overview of CI integration section.
GitHub Actions
On the tab of the GitHub UI, create the
QODANA_TOKENencrypted secret and save the project token as its value. If you are using a Qodana Cloud instance other thanhttps://qodana.cloud/, override it by declaring theQODANA_ENDPOINTenvironment variable.On the tab of the GitHub UI, set up a new workflow and create the
.github/workflows/code_quality.ymlfile.To analyze the
mainandmasterbranches, as well as release branches and the pull requests coming to your repository, save this workflow configuration to the.github/workflows/code_quality.ymlfile:name: Qodana on: workflow_dispatch: pull_request: push: branches: # Specify your branches here - main # The 'main' branch - master # The 'master' branch - 'releases/*' # The release branches jobs: qodana: runs-on: ubuntu-latest permissions: contents: write pull-requests: write checks: write steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit fetch-depth: 0 # a full history is required for pull request analysis - name: 'Qodana Scan' uses: JetBrains/qodana-action@v2025.2 env: QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
Jenkins
Jenkins is a good example of how you can use Docker images of Qodana.
Prepare your project
Make sure that these plugins are installed on your Jenkins instance:
Docker and Docker Pipeline are required for running Docker images
git is required for git operations in Jenkins projects
Make sure that Docker is installed and accessible to Jenkins.
If applicable, make sure that Docker is accessible to the jenkins user as described in the Manage Docker as a non-root user section of the Docker documentation.
Create a Multibranch Pipeline project as described on the Jenkins documentation portal.
In the root directory of your project repository, create the Jenkinsfile. This file will contain Jenkins configuration scripts described in this section.
This is the basic configuration of the Jenkins Pipeline.
In this configuration, the environment block defines any environment variables to be used in the pipeline. The QODANA_TOKEN variable refers to the project token generated in Qodana Cloud and is contained in the qodana-token global credentials.
This configuration uses the docker agent to invoke Qodana Docker images. Using the WORKSPACE variable, the args block mounts the local checkout directory to the project directory of a Docker image, and image specifies the Docker image invoked.
What's next
You can extend the existing CI configurations. For example, you can employ the quality gate or baseline features.