Versions Compared

Key

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

...

  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
    

...