Integrate Acrolinx into Jenkins

Make sure you're familiar with how to configure and run of the CLI.

We assume that your project already contains a CLI configuration file like  .cli-config.json .

We also assume that the Jenkins slave runs on linux. If not, you might have to make some minor changes.

How to Set Up a Job

  • Set up a new Freestyle Jenkins job:

    Click New Item

    Enter a Name

  • Or modify an existing:

    Configure

  • Specify the repository you want to check:

    Add a source code repository

  • Configure the Access Token and the Acrolinx URL. Depending on security and your infrastructure, you can:

  • Make sure that the CLI is installed on the Jenkins slave. To be able to run the CLI, you might have to set the executable permission.

    chmod +x bin/acrolinx-cli*
        
  • Add an Execute shell build step, that calls CLI with its config:

    bin/acrolinx-cli* check --config .cli-config.json

    Execute shell build step

  • Make sure that you installed the JUnit Plugin.

  • Configure a post build action to publish the test results of results/xunit.xml.

    publish xunit.xml post build action

  • Save the job configuration.

  • To run the job, click Build Now:

    Build Now

    Run the job

  • To show a trend diagram, the publish test results post build action requires two, or more runs. Afterwards a diagram is shown:

    Trend

  • Jenkins will also show failing tests by in the build status:

    Build history

For each checked file, one XUnit test case is created. By default the CLI fails a test case, if the status is red, or yellow. You can restrict the failing of the tests to red only by specifying the option --fail-on-red.

Jenkins can also be configured to fail the job, if tests fail.