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. 

NOTE: Before you begin, make sure that the relevant package manager is installed. For details, see This page is available at: https://whitesourcedocs.atlassianmend.netio/wiki/spaces/WD/pages/1140852201/Getting+Started+with+the+Unified+Agent#Prerequisites.

How It Works

To integrate Travis CI with Mend, 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 Mend integration

    Code Block
    languagebash
    language: bash
    
    script:
        - bash <(curl -s -L https://github.com/Mend/unified-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 Mend 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.

...

Advanced Options

Policy Violations

You can fail builds in case of policy violation(s). To achieve this task, you can use the configuration file that you already defined to check policies. Use the configuration file ('-c parameter') with the following '.travis.yml' file:

Sample .travis.yml with Mend integration
Code Block
languagebash
language: bash

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

Note

Your configuration file name should be different from 'Mend-fs-agent.config'. The script ('wss_agent.sh') downloads the default file ('Mend-fs-agent.config') and overrides your file when it has the same name.

Alternatively, you can use the following '.travis.yml' file:

This script downloads the default configuration file and changes its privacy policies values.

Sample .travis.yml with Mend integration
Code Block
languagebash
language: bash

script:
	# Download the latest version of the Mend Unified Agent
    - curl -LJO https://github.com/Mend/unified-agent-distribution/releases/latest/download/wss-unified-agent.jar
	# Download the default configuration file
    - curl -LJO https://github.com/Mend/unified-agent-distribution/raw/master/standAlone/wss-unified-agent.config
	# Replace the flags in the configuration to enable policy check
    - cat wss-unified-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 wss-unified-agent.config
	# Run Mend FS Agent
    - java -jar wss-unified-agent.jar -apiKey xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -c wss-unified-agent.config -d ~/ -project travisCI_test
    

Note

The default configuration file may require further configuration modifications to suit your requirements.

If there are policy violations, then the following message appears at the end of the "Job log" of Travis CI :
Process finished with exit code POLICY_VIOLATION (-2)

Sample of Usage on GitHub

The following screenshot illustrates cloning a GitHub project while using the Travis CI integration:

...

The following screenshot is an example of a policy violation:

...

bundle/unified_agent/page/travis_ci_integration.html