Jenkins Plugin

Instructions to install the plugin:

1 - Download file codacy-plugin-jenkins.hpi (see attachment at the bottom of the page)
2 - From the Jenkins Dashboard, go to Manage Jenkins > Manage Plugins
3 - In the Advanced tab, under Upload Plugin, click Choose File
4 - Navigate to the plugin .hpi file and select it.
5 - Click Upload
6 - Restart Jenkins


In your project Settings, you can now see a new "Codacy configuration” section. Below are the instructions to configure the Codacy integration:

1 - Fill the API Token (not the project token), Organization name and Project name. The API Token can be generated in your Codacy Account, under the “API Token” tab.
2 - Add a new build step named “Check Codacy Results”
3 - Configure the new build step to break the build with the desired conditions. In this case, you probably want to fill the project grade with “A” and the project coverage with 80.
4- Click save

Have more questions? Submit a request

5 Comments

  • 0
    Avatar
    mannesiddhardha

    unable to download jenkins plugin

  • 0
    Avatar
    Codacy Team

    Hi there! We have sent you an email. Thank you 

  • 0
    Avatar
    Derek Suzuki

    I'm not quite ready to test this integration, but I tried installing the plugin in a Jenkins instance (2.27) to see what it looked like.  I immediately saw two problems:

    1) The UI for configuring freestyle jobs became completely broken, with an exception stacktrace at the top and the header for a Codacy configuration section at the bottom.  I removed the plugin and restarted, and the problem went away.  At some point I can test this with a more recent Jenkins release.

    2) There don't appear to be any step definitions for using the plugin in a Jenkins pipeline.  Is there documentation on invoking the class directly?  Has it been tested at all in a pipeline job?  I could theoretically pass the coverage report artifact to a downstream job and use that to publish results to Codacy, but that would be a much kludgier solution than just using a pipeline step.

  • 0
    Avatar
    Codacy Team

    We already have a ticket in place to check if the plugin works with a pipeline. We will get back to you as soon as there is an update on this.

    Thank you 

  • 0
    Avatar
    Christopher Brown

    Having an issue with this plugin. I am supplying the project token in the plugin configuration but still get token undefined

    ```

    + cat ./reports/coverage/lcov.info
    + ./node_modules/.bin/codacy-coverage --debug --commit 81e56d2827264fcbd74fab1b842c6417d9db8e3a
    [info] "2017-05-24T07:21:07.457Z"  'Started with: token [undefined], commitId ["81e56d2827264fcbd74fab1b842c6417d9db8e3a"], language [undefined], endpoint [undefined], format [undefined], path prefix [undefined], verbose [undefined], debug [true]'
    [trace] "2017-05-24T07:21:07.462Z"  'Got chunk'
    [trace] "2017-05-24T07:21:07.463Z"  'Got chunk'
    [trace] "2017-05-24T07:21:07.463Z"  'Got chunk'
    [trace] "2017-05-24T07:21:07.465Z"  'Received file through stdin'
    [error] "2017-05-24T07:21:07.469Z"  'Error sending coverage'
    [error] "2017-05-24T07:21:07.469Z"  Error: Token is required
        at Object.module.exports [as handleInput] (/var/lib/jenkins/workspace/SIT-Responsive-assets/node_modules/codacy-coverage/lib/handleInput.js:19:35)
        at Socket.<anonymous> (/var/lib/jenkins/workspace/SIT-Responsive-assets/node_modules/codacy-coverage/bin/codacy-coverage.js:45:20)
        at emitNone (events.js:91:20)
        at Socket.emit (events.js:188:7)
        at endReadableNT (_stream_readable.js:975:12)
        at _combinedTickCallback (internal/process/next_tick.js:80:11)
        at process._tickCallback (internal/process/next_tick.js:104:9)
    Getting commit information from Codacy
    Could not get commit information from Codacy so we are skipping this step```
Please sign in to leave a comment.