Skip to content

Travis CI Integration

Ochrona Security edited this page Dec 9, 2019 · 2 revisions

Travis CI Integration

This guide will show you how to include Ochrona CLI into your CI/CD process using Travis-ci.

Steps

  1. Get an Ochrona API key if you don't already have one from Ochrona.dev.
  2. (Optional) If you don't already have travis-ci configured for your project, I'd suggest following this guide - https://docs.travis-ci.com/user/tutorial/
  3. Add your Ochrona API key as an environment variable in travis-ci.
    1. On the right side of your build page click the More Options button and select Settings from the dropdown. More Options
    2. Scroll down the Settings menu until you reach the Environment Variables section. Create a new environment variable named OCHRONA_API_KEY and set the value to equal your API key from step #1. Add the variable. Add Env Var Env Var Added
  4. In your travis.yml file, add the following step to the scripts section - ochrona. Note if you only want to check a specific dependency file you can add the --file option. There are also multiple other options available to tailer your build process.

Example travis.yml

language: python
python:
  - 3.6
install:
  - python --version
  - pip install -U pip
  - pip install pipenv
  - pipenv install --dev
script:
  - pytest ./tests
  - ochrona --file ./Pipfile.lock
Clone this wiki locally