Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

Overview

Travis CI 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. Travis CI runs on GitHub repositories, and it enforces security and licensing compliance in the CI/CD pipeline. 

How It Works

To integrate Travis CI with WhiteSource, apply the following procedure:

  1. Add or merge the following content to your '.travis.yml' file (usually it is located in the root directory of the repository):

    NOTE: 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 scheduler task, such as cron.

    Sample .travis.yml with WhiteSource integration

    Code Block
    languagebash
    language: bash
    
    script:
        - bash <(curl -s -L https://github.com/whitesource/fsunified-agent-distribution/raw/master/standAlone/wss_agent.sh) -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c [path to config file] -project travis-ci_test -d . 

    This command runs the script 'wss_agent.sh'. It downloads the latest version of the WhiteSource Unified Agent Jar file and configuration file to your Travis CI host.

          Afterwards, the script runs the Jar with the regular command-line arguments of the Unified Agent.

          Make sure to edit the Unified Agent configuration file to match your needs. See Unified Agent command line parameters for further information.
          Use the API key and determine the name of the WhiteSource project.

      2. Run the build. After the Travis CI build completes with a WhiteSource scan, you can review the scanning results in your WhiteSource organization.      

...

Code Block
languagebash
language: bash

script:
    - bash <(curl -s -L https://github.com/whitesource/fsunified-agent-distribution/raw/master/standAlone/wss_agent.sh) -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c [path to config file] -project travis-ci_test -d . 

...

Code Block
languagebash
language: bash

script:
	# Download the latest version of the WhiteSource FSUnified Agent
    - curl -LJO https://github.com/whitesource/fsunified-agent-distribution/rawreleases/masterlatest/standAlonedownload/whitesourcewss-fsunified-agent.jar
	# Download the default configuration file
    - curl -LJO https://github.com/whitesource/fsunified-agent-distribution/raw/master/standAlone/whitesourcewss-fsunified-agent.config
	# Replace the flags in the configuration to enable policy check
    - cat whitesourcewss-fsunified-agent.config | sed -e "s/checkPolicies=false/checkPolicies=true/; s/forceCheckAllDependencies=false/forceCheckAllDependencies=true/" > temp_file.config
	# Copy the new configuration file over the original file
    - mv temp_file.config whitesourcewss-fsunified-agent.config
	# Run WhiteSource FS Agent
    - java -jar whitesourcewss-fsunified-agent.jar -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c whitesourcewss-fsunified-agent.config -d ~/ -project travisCI_test
    

...