Using the Java Thin client

Using AzureDevops with the Java Thin client

If you decide to not use the Docker image with your Azure pipeline, you will need to update the configuration file azure-pipelines.yml with this small snippet, which will download and invoke the client:

steps:
- script: |
    curl -s "https://www.meterian.io/downloads/meterian-cli.jar" -o meterian-cli.jar
  displayName: 'Download Meterian Java thin client'

- script: |
    java -jar meterian-cli.jar
  displayName: 'Run Meterian analysis'
  env:
    METERIAN_API_TOKEN: $(METERIAN_API_TOKEN)

The requirement is for the base image to have java installed (most images do, see the Azure documentation for details). A working example of the non-native integration using the Java Thin client can be found here.

Please remember that, before invoking the client, you will also need to make sure that the relevant tools are installed and configured in your pipeline. So, for example, if you need to analyse a NodeJS project you will need to install, prior to Meterian, the required tooling, like in this example:

- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js (Meterian will need it as this is a Node project)'

Meterian will be launched against the project source code every time a new change is committed and pushed in your repository. Rember to set the METERIAN_API_TOKEN environment variable, see the Azure Devops section for instructions.

Here's a list of integration examples for every language:

Integration example running on Windows VMs

If your pipeline is running on a windows VM here is an example snippet you should use or refer to

trigger:
- main

pool:
 vmImage: 'windows-latest'

steps:
- script: |
    curl.exe -s "https://www.meterian.io/downloads/meterian-cli.jar" -o meterian-cli.jar 
  displayName: 'Download Meterian Java thin client'

- script: |
    java -jar meterian-cli.jar --folder="$(Build.SourcesDirectory)"
  displayName: 'Run Meterian analysis'
  env:
    METERIAN_API_TOKEN: $(METERIAN_API_TOKEN)

A live example can also be found here.

Last updated