Table of Contents
Introduction
This article provides instructions on how to integrate Bamboo with the Unified Agent via a Windows PowerShell Interpreter or Linux shell commands.
Option 1: Bamboo Script Task Using Windows PowerShell Interpreter
Setup
- Create a project and fill in the fields:
- Create a new plan:
- Fill in the fields and select 'None' for a repository in order to work on a local workspace.
- Select 'Enable Plan':
- Run this job in an Agent environment and add a task:
- Select a 'Script' task type:
- Enter a description for the task, select a 'Windows PowerShell' interpreter, and an 'Inline' script location.
- Enter the following in the 'Script body' text box:
Code Block | ||||
---|---|---|---|---|
| ||||
powershell start-bitstransfer 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 start-bitstransferbitsadmin /transfer mydownload /dynamic /download /priority FOREGROUND "https://raw.githubusercontentgithub.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] |
The first command downloads the latest version of WhiteSource Unified Agent Jar file to the job folder.
The second command downloads the latest version of WhiteSource Unified Agent configuration file to the job folder.
The third command runs the Jar with regular command line arguments of the Unified Agent.
Save the job.
Info | ||
---|---|---|
| ||
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. |
Make sure to edit the Unified Agent configuration file to match your needs.
Make sure that Background Intelligent Transfer Service (BITS) is enabled on your project job.
Running the Job
- Go to the Configuration page of the plan select 'Run plan':
- The Build Result Summary is then displayed:
...
Info |
---|
'ApiKey' is in configuration file, and therefore, it is not in the script. |
Running the Job
Save , Enable job and run it in the way that is described in the previous section.