Jenkins

How to integrate Meterian with Jenkins pipeline

The integration of Meterian with Jenkins is very simple and it requires just a couple of steps:

  • First of all set METERIAN_API_TOKEN as environment variable. Environment variable can be set on Configure System from Manage Jenkins.

To retrieve a Meterian API Token visit the Meterian Dashboard; in your account select the tab "Tokens" and create a new one, or use an existing one.

API tokens are available only on paid account. To upgrade your subscription, please contact us.

  • On the main build task simply add an extra step, selecting 'Execute shell' from the dropdown menu

And copy/paste this code snippet

docker run --rm \
--volume ${PWD}:/workspace --env METERIAN_API_TOKEN=$METERIAN_API_TOKEN \
meterian/cli [Meterian CLI Options]

Learn more about the Meterian Client here.

How does it work

Jenkins docker will download and set the Meterian container, which contains the latest version of the Meterian client and the building tools for all the supported languages, then Meterian will be launched against the project.

Finally, given the result of the scan, the Jenkins task will pass or it will fail.