CircleCI Integration

Overview

CircleCi is a continuous integration development platform that is being used by software teams in order to enable them to build, test and deploy applications easier and faster on multiple platforms.

NOTE: Before you begin, make sure that the relevant package manager is installed. For details, see https://whitesource.atlassian.net/wiki/spaces/WD/pages/1140852201/Getting+Started+with+the+Unified+Agent#Prerequisites .

Integrating with CircleCI

To integrate CircleCi with Mend, do as follows:

  1. Add the following build steps to your circle.yml file:

    Notice on periodically fetching the Unified Agent - It is advised to use the below curl command only once a week to download the latest version of the Unified Agent for performance reasons and not as part of every build. You can do this using a task scheduler, such as cron.

    Sample circle.yml with Mend integration

    1 2 3 4 steps: chmod +x wss_agent.sh - run: bash <(curl -s -L https://github.com/Mend/unified-agent-distribution/raw/master/standAlone/wss_agent.sh) -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c [path to config file] -project circle-ci_test -d ~/ 

     

  2. This command runs the script "wss_agent.sh". It downloads the latest version of the Mend Unified Agent jar file and config file to your CircleCI host. Then, the script runs the jar with the regular command line arguments of the Unified Agent.

  3. Make sure to edit the Unified Agent configuration file to match your needs.
    NOTE: The API key is confidential and should be hidden. Consider using it as an environment variable in your .yml file. See the Unified Agent command line parameters for further information.

  4. Use the API key and determine the name of the Mend project.

  5. Run the build. After the CircleCI build completes with a Mend scan, you can review the scanning results in your Mend organization.      

Examples

Basic Example

script:

  - pipe: whitesourcesoftware/Mend-scan:1.3.0

Advanced Example

script:

  - pipe: whitesourcesoftware/Mend-scan:1.3.0

    variables:

        API_KEY: $API_KEY

        DIRECTORY: '.'

        CONFIG_FILE_PATH: './someFolder/wss-unified-agent.config'

        COMMANDS_FILE_PATH: './someFolder/install-commands.sh


Commands File

The commands file prepares the environment for Circle CI Orbs integration to run as expected, in addition to adding NuGet to the resolution.

Commands file example: