Travis CI

Tutorial for an integration using the provided REST endpoint

In this tutorial we will walk you through a setup using Travis CI. A simple example app can found here - if you want to try it directly, create your own VSM workspace.

Providing metadata

The static lx-manifest is a yaml-file added on the root level of each repository that you want to recognize as a microservice. A lx-manifest.yaml follows a fixed base structure but can also be flexibly advanced with custom data. For our example case we keep the data simple, but you can find a full breakdown of the options here

To get started we create our lx-manifest.yaml in the root of our app's directory and fill it with the metadata we want to push:

id: myfirstapp
name: myfirstapp
description: First app to showcase CICD integration.
owner: [email protected]
  - name: Github

Create a build script

This script will essentially tell travis how to collect the relevant data (app metadata from lx-manifest.yaml file & libraries info from license-checker) and how to send it to the CI/CD connector API. When Travis runs this script, we need to tell Travis where to find our workspace and how to access it.

Open a terminal on your machine and navigate to your app's directory. In the root create a folder:

mkdir build

Create a file called and make it executable:

touch build/
chmod +x build/

Paste the below code into the script - collects data and sends it to the CI/CD connector API. You can optionally read the comments in the code to get an idea of what exactly the code does.

# If MI_DEV_HOST isn't set in travis, a default value is used
export HOST=${}

# Check if token env variable is set in travis
if [[ -z "${VSM_DEV_TOKEN}" ]]; then
    echo "Please add your workspace token as an env variable 'MI_DEV_TOKEN' in travis."
    exit 1

# Fetch bearer token
export SYNC_URL="https://${HOST}/services/integration-api/v1/synchronizationRuns"
TOKEN=$(curl -X POST --url https://${HOST}/services/mtm/v1/oauth2/token -u apitoken:${MI_DEV_TOKEN} --data grant_type=client_credentials | jq -r '.access_token') 

# Run license-checker
license-checker --json > $TRAVIS_BUILD_DIR/build/dependencies.json

# API call to send the manifest file, dependencies and metadata to workspace
# Required input data in the API call:
# Bearer token (provided as a part of header)
# Absolute path for dependencies.json
# Absolute path for lx-manifest.yaml
# version, stage & dependencyManager (hardcoded for this sample code)
curl -X POST \
  -H 'Cache-Control: no-cache' \
  -H "Authorization: Bearer ${TOKEN}" \
  -H 'Content-Type: multipart/form-data' \
  -F [email protected]"$TRAVIS_BUILD_DIR/build/dependencies.json" \
  -F [email protected]"$TRAVIS_BUILD_DIR/lx-manifest.yaml" \
  -F 'data={
  "version": "1.1.0",
  "stage": "dev",
  "dependencyManager": "NPM"
}' \

To tell Travis to run our build_script after every successful deployment we’ll make some changes to the .travis.yml file. Add the below code to your .travis.yml file:

- ./build/

Authorizing the pipeline

We need to tell Travis the domain and API token of our VSM workspace to push the collected metadata. To do that, open Travis in your browser, open the settings of your repo as shown in the screenshot below:


In the settings, add two environment variables:

  • VSM_DEV_HOST: Your workspace’s domain name e.g. ""
  • VSM_DEV_TOKEN: Your workspace’s API token.

Starting the Integration

You can start a run of the integration by triggering a new build in Travis:


Accessing data in the workspace

Now, go into your VSM workspace to see the generated software artifact, deployment & license fact sheets.

2494 2862