Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

This page provides step-by-step instructions on how to run the Unified Agent from Azure DevOps Services.

...

Unified Agent Configuration

...

Download the Unified Agent configuration file. 

Save this file to your local machine.

Edit the includes, archiveIncludes, and archiveExtractionDepth sections of the configuration file to support the relevant file or archive extensions. For more information, see the Configuration File & Parameters page.

Upload the modified configuration file to your Azure DevOps Project Repo.

...

Browse your file system to select your local version of the Unified Agent configuration file and click Commit.

...

The below integration uses environment variables to configure the Unified Agent so that the default configuration values are used.

For more information, see the following articles
Getting Started with the Unified Agent
https://whitesource.atlassian.net/wiki/spaces/WD/pages/1544880156/Unified+Agent+Configuration+Parameters#Configuring-the-Unified-Agent-by-Environment-Variables

Setting up Your Build Pipeline

...

  1. In the Where is your code? screen, select a YAML-enabled option.

    Image RemovedImage Added
  2. In the Select a repository screen, select your repository.

    Image RemovedImage Added
  3. In Configure your pipeline, select the relevant pipeline configuration.

    Image RemovedImage Added
  4. In Review your pipeline YAML, add the following text as a post-build step. This activates the WhiteSource integration on your build pipeline.

    Code Block
    languageyaml
    - script: ' |
        curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download/.s3.amazonaws.com/wss-unified-agent.jar'
      displayName: 'Download the latestecho Unified Agent' downloaded successfully
      - script: 'java -jar wss-unified-agent.jar -c wss-unified-agent.config -apiKey <API_KEY> -project <PROJECT_NAME>'
      env:
        WS_APIKEY: $(APIKEY)
        WS_USERKEY: $(USERKEY)
        WS_WSS_URL: $(WSS_URL)
        WS_PRODUCTNAME: AZDO_$(System.TeamProject)
        WS_PROJECTNAME: $(Build.Repository.Name)_$(Build.SourceBranchName)
      displayName: 'RunWhiteSource Unified Agent Scan'
  5. Add environment variables for APIKEY, USERKEY, and WSS_URL, as described by the Microsoft documentation, https://docs.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch

  6. Click Save and run.

Option 2: Creating a Pipeline Without YAML (Classic Editor)

  1. Select the type of repository:

    Image RemovedImage Added
  2. Select an Empty job:

    Image RemovedImage Added
  3. Enter a name for the job and select an Agent pool:

    Image RemovedImage Added
  4. Add the relevant pre-step build task (Maven, npm install, Gradle, .NET Core, etc.).

    Image RemovedImage Added
  5. Add a CLI task in order to download the latest version of the Unified Agent to your local environment.

    Image Removed

    Enter the following:

  6. Display name: Download the latest Unified Agent

  7. Script: curl -LJO https://github.com/whitesource/unified-agent-distribution/releases/latest/download

    Command Line task and update the following fields to activate the WhiteSource integration on your build pipeline.

    • Display name: WhiteSource Unified Agent Scan

    • Script:

      Code Block
      languageyaml
      curl -LJO https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar

      NOTE: It is advised to use the 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 scheduler task, such as cron.
      Image Removed

    Add a CLI task in order to run the Unified Agent using the configuration file you initially downloaded in steps 1 and 2. Make sure you provide a valid API key, product name and project name.

    • Display name: Run Unified Agent Scan

    • Script: java -jar
      
      echo Unified Agent downloaded successfully
      java -jar wss-unified-agent.jar
      -c wss-unified-agent.config -apiKey <API_KEY> -product <PRODUCT_NAME> -project <PROJECT_NAME>
      Image Removed
    • Environment Variables:

      • WS_APIKEY: your-apiKey

      • WS_USERKEY: your-userKey

      • WS_WSS_URL: your-wssUrl

      • WS_PRODUCTNAME: AZDO_$(System.TeamProject)

      • WS_PROJECTNAME: $(Build.Repository.Name)_$(Build.SourceBranchName)

  8. Click Save& queue.