Skip to main content
Skip table of contents

Bamboo Integration

Overview

This page describes how to integrate Bamboo with the Unified Agent via a Windows PowerShell Interpreter or by using Linux shell commands.

NOTE: Before you begin, make sure that the relevant package manager is installed. For details, see Scanning With The Unified Agent

Option 1: Bamboo Script Task Using Windows PowerShell Interpreter

Setup

  1. Create a project and fill in the fields:

  2. Create a new plan:

  3. Fill in the fields and select None for a repository in order to work on a local workspace.

  4. Select Enable Plan.

  5. Run this job in an Agent environment and add a task:

  6. Select a Script task type:

  7. Enter a description for the task, select a Windows PowerShell interpreter, and an Inline script location.

  8. Enter the following in the Script body text box, edit the configuration file to match your needs, and save when done:
    NOTE: Ensure that Background Intelligent Transfer Service (BITS) is enabled on your project job.

    CODE
    powershell bitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND "https://github.com/whitesource/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar"  $pwd\wss-unified-agent.jar 
    powershell bitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND "https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.config"  $pwd\wss-unified-agent.config 
    java -jar wss-unified-agent.jar -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx [-u userKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx] -c [path to config file] -project my-project -d [path to folder to scan]

Note the following:

  • The first command downloads the latest version of Mend Unified Agent jar file to the job folder.

  • The second command downloads the latest version of Mend Unified Agent configuration file to the job folder.

  • The third command runs the Jar with regular command-line arguments of the Unified Agent.

It is advised to use the above PowerShell commands 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 scheduler task, such as cron.

Running the Job

  1.  Go to the Configuration page.

  2. Select Run plan:

  3. The Build Result Summary is then displayed:

Option 2: Bamboo Script Task Using Shell or the 'cmd.exe' Interpreter 

Setup

  1. Download CURL, add it to your PATH environment variable, and restart Bamboo.

  2. Create a project via the same steps that were described in the previous section.

  3. In the new Script Body window add the following commands: 

    CODE
    curl -LJO https://github.com/whitesource/unified-agent-distribution/raw/master/standAlone/wss_agent.sh
    wss_agent.sh -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c [path to config file] -project my-project -d [path to folder to scan]

Note the following:

  • The first command downloads the wss_agent.sh script file to the job folder.

  • The second command runs the script wss_agent.sh. This script downloads the latest version of whitesource Unified Agent jar file and configuration file to your Bamboo job 'workspace' folder.

  • The script runs the jar with regular command-line arguments of the Unified Agent.

NOTES:

  • ApiKey is in the configuration file, and therefore, it is not in the script.

  • Ensure that you edit the Unified Agent configuration file to match your needs.

Running the Job

Save, enable the job and run it in the way that is described here.

More Examples

Additional examples for CI/CD pipelines can be found at https://github.com/mend-toolkit/mend-examples/tree/main/CI-CD .  

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.