|
| 1 | +--- |
| 2 | +title: Using SourceClear with Travis CI |
| 3 | +layout: en |
| 4 | +permalink: /user/sourceclear/ |
| 5 | +--- |
| 6 | +[SourceClear](https://www.sourceclear.com) is security for open-source code. |
| 7 | + |
| 8 | +When you add SourceClear to your TravisCI projects you'll get automated security analysis inside every build. You’ll get complete analysis of your open-source dependencies, including security vulnerabilities, out-of-date libraries, and license reports. |
| 9 | + |
| 10 | +## Creating your Authentication Token |
| 11 | + |
| 12 | +In order to set up the SourceClear agent for Travis-CI, you must be logged into [SourceClear](http://app.sourceclear.com/login), and then perform the following steps: |
| 13 | + |
| 14 | +**1.** From the left sidebar, select **Agents**, then **New Agent**. |
| 15 | + |
| 16 | +**2.** In the agent setup page, select **Travis-CI** |
| 17 | + |
| 18 | +**3.** Select **Create Authentication Token**, and copy it to your clipboard. You will use this to authenticate with SourceClear during scans. |
| 19 | + |
| 20 | +## Setting the Environment Variable |
| 21 | + |
| 22 | +Setting an environment variable in Travis-CI occurs on a per repository basis: |
| 23 | + |
| 24 | +**1.** Select the repository you wish to scan from your Travis-CI environment > |
| 25 | +**More Options** > **Settings** |
| 26 | + |
| 27 | +**2.** On the Environment Variables page, add `SRCCLR_API_TOKEN` and assign your authentication token to it. Make sure to toggle the button labeled **Display value** in build log* to the **OFF** position to ensure your token is kept secret. |
| 28 | + |
| 29 | +<img src="/images/srcclr-travis.png" alt="SourceClear" width="100%"/> |
| 30 | + |
| 31 | + |
| 32 | +## Configuring your Travis-CI repository |
| 33 | + |
| 34 | +In order to scan using SourceClear, add the following to your `.travis.yml` file: |
| 35 | + |
| 36 | +``` |
| 37 | +addons: |
| 38 | + srcclr: true |
| 39 | +``` |
| 40 | + |
| 41 | +If you want verbose output during the scan, you can add the `debug` key: |
| 42 | + |
| 43 | +``` |
| 44 | +addons: |
| 45 | + srcclr: |
| 46 | + debug: true |
| 47 | +``` |
| 48 | + |
| 49 | +Commit these changes to trigger a build for your repository, and SourceClear will perform a scan, displaying results to your SourceClear environment. |
| 50 | + |
| 51 | +If you wish to add SourceClear scanning to other repositories, simply add the installation and scan code above to whatever `.travis.yml` files you wish, as well as the `SRCCLR_API_TOKEN` environment variable and you will be able to perform scans on each new build. |
0 commit comments