Make sure you're familiar with how to configure and run the CLI.
We assume that your project already contains a CLI configuration file like .cli-config.json
.
We also assume that the Jenkins agent runs on linux. If not, you might have to make some minor changes.
Warning
The following use case only an example. We don’t recommend that you follow it step by step, especially if you want to use it in a different environment. For more information about CLI use cases, contact your Acrolinx consultant.
-
Set up a new Freestyle Jenkins job:
-
Or modify an existing:
-
Specify the repository you want to check:
-
Configure the Access Token and the Acrolinx URL. Depending on security and your infrastructure, you can:
-
Use the
Mask Passwords Plugin
: -
Set the environment variables on the agent, or
-
-
Make sure that the CLI is installed on the Jenkins agent. 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
-
Make sure that you installed the
JUnit Plugin
. -
Configure a post build action to publish the test results of
results/xunit.xml
. -
Save the job configuration.
-
To run the job, click
Build Now
: -
To show a trend diagram, the publish test results post build action requires two, or more runs. Afterwards a diagram is shown:
-
Jenkins will also show failing tests by in the build status:
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.