In this article we will make the necessary modifications to a simple TeamCity project to scan a GitHub repository with SOOS.

Integration Steps

Open the SOOS App, browse to Integrate > CI/CD/Repo > CI/CD > TeamCity

  • Click the "Download" link and get the latest release of the soos.py and requirements.txt files

  • Create the following directory structure in your root codebase "soos/workspace"

  • Place the soos.py and requirements.txt files under the "soos" directory

Technical details for the script can be found here: https://github.com/soos-io/soos-ci-analysis-python

Note the API Key and Client ID values, you will need these below.

Repo Setup

  1. Create a new folder in your GitHub repository: <repo_root>/soos/workspace/
  2. Place the requirements.txt and soos.py files <repo_root>/soos/ folder that you created in step # 1 above.
  3. Commit these 2 new files and the new folder path to GitHub.

Configure TeamCity

Build Setup

Navigate to your project’s Build Configuration

build configuration

On the left-hand menu, select “Parameters” to review your environment variables.

Setup Environment Variables

Create the env.SOOS_API_KEY and env.SOOS_CLIENT_ID environment variables in the provided “Environment variables” text field. These will serve as environment variables to be used by the SOOS CLI. Use the API Key and Client ID values you collected from the SOOS App.

build parameters

Add The Build Configuration

Within your BUILD CONFIGURATION, select BUILD STEPS within the left-hand menu, then add a new build step.

add build steps

When prompted, select “Command Line” from the menu.

select command line

Add a step name that is relevant (such as SOOS Analysis) and enter the “Custom Script” from the SOOS App. Make sure to set the Project Name (which groups scans together) and the Build and Branch parameters. Providing the branch/build parameters allows us to tie together scans and issues, and provide more meaningful insights and actionability to you.  Save your new step.

Note: If you are running TeamCity on Windows, you should use the example Windows Command script here.








Configure the Script Parameters

Within your BUILD CONFIGURATION, select PARAMETERS within the left-hand menu. All the parameters shown below should appear in the list, however they will indicate that a value is required. Use the values shown below and then customize as needed.

configure parameters

Run It

To run the SOOS CLI against your repository’s code, just execute a build or commit a change. The build will use the environment variables that you created for the API Key and Client ID.