[en] Make sure you're familiar with how to configure and run the CLI.
[en] We assume that your project already contains a CLI configuration file like .cli-config.json
.
[en] We also assume that the Jenkins agent runs on linux. If not, you might have to make some minor changes.
Warnung
[en] 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.
-
[en] Set up a new Freestyle Jenkins job:
-
[en] Or modify an existing:
-
[en] Specify the repository you want to check:
-
[en] Configure the Access Token and the Acrolinx URL. Depending on security and your infrastructure, you can:
-
[en] Use the
Mask Passwords Plugin
: -
[en] Set the environment variables on the agent, or
-
-
[en] 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*
-
[en] Add an
Execute shell
build step, that calls CLI with its config:bin/acrolinx-cli* check --config .cli-config.json
-
[en] Make sure that you installed the
JUnit Plugin
. -
[en] Configure a post build action to publish the test results of
results/xunit.xml
. -
[en] Save the job configuration.
-
[en] To run the job, click
Build Now
: -
[en] To show a trend diagram, the publish test results post build action requires two, or more runs. Afterwards a diagram is shown:
-
[en] Jenkins will also show failing tests by in the build status:
[en] 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
.
[en] Jenkins can also be configured to fail the job, if tests fail.