Pushing results from Build Server

Codacy Enterprise supports pushing analysis results from your build server using the Codacy Analysis CLI.

 

Marking project as remote

A. Enable a specific project as remote

Go into the project, enter the settings and in section Project analysis enable Run analysis through build server

Screen_Shot_2018-07-05_at_3.06.09_pm.png

 B. Enable all projects as remote by default

Go to the admin panel, enter the settings tab and enable Run analysis for all projects through build server, by default.

Screen_Shot_2018-07-05_at_3.07.15_pm.png

Be sure to push results through the CLI after enabling any of this settings, otherwise the project affected will not trigger any analysis.

 

Setup the Codacy Analysis CLI

Follow the installation guide and get the codacy-analysis-cli executable running in your build server.

 

Run an analysis with the CLI

For now, the CLI still requires to retrieve the configuration in Codacy to perform an analysis.

For this reason, after you configure this to run you also need to give access to read the project configuration from Codacy.

The recommended way is to obtain a Project Token as explained in the CLI documentation.

You also have to configure the endpoint where Codacy enterprise is running either by using the --codacy-api-base-url flag or the environment variable CODACY_API_BASE_URL.

After you have the token and the enterprise installation configured you can invoke the CLI as follows to get a report with all the issues.

codacy-analysis-cli analyse --directory <SOURCE-CODE-PATH> --project-token <PROJECT-TOKEN> --codacy-api-base-url <API-BASE-URL>

If you don't specify the tool, it will run as Codacy does in the backend, if you only want results for a specific one you can pass it with --tool.

Push Results to Codacy

If you want to push the results to Codacy, pass a flag --upload in the previous command too.

 

Docs

To configure some advanced details, check all the CLI flags in the CLI documentation.

Some flags you might be interested in are --allow-network - to run the tools that require compilation like FindBugs, --max-allowed-issues - to return a non-zero exit code when a certain number of issues is exceeded, --fail-if-incomplete - to return a non-zero exit code when any tool fails to run successfully.

If you run into any issues or have any questions, do not hesitate to send us an email at support@codacy.com.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.