In this article we will make the necessary modifications to a simple CircleCI project to scan a GitHub or Bitbucket repository with the SOOS CircleCI Orb.
Open the SOOS App, browse to Integrate > CI/CD/Repo > CI/CD > CircleCI
Note the API Key (SOOS_API_KEY), Client ID (SOOS_CLIENT_ID) and Script (Script Integration) values, you will need these below to set up the Environment Variables.
Technical details for the script can be found here: https://github.com/soos-io/soos-ci-analysis-circleci-orb
- Create a directory called
.circleciin the root directory of your local GitHub or Bitbucket code repository.
- Create a
config.ymlfile inside the
.circlecidirectory with the following lines (if you are using CircleCI server v2.x, use version: 2.0 configuration):
version: "2.1" orbs: soos: firstname.lastname@example.org workflows: main: jobs: - soos/analysis_run_and_wait: client_id: $SOOS_CLIENT_ID # Environment Variable defined on Setup Environment Variables section api_key: $SOOS_API_KEY # Environment Variable defined on Setup Environment Variables section project_name: "Project Name"
Commit and push the changes.
Go to the Projects page in the CircleCI app, click the Add Projects button, then click the Set Up Project button next to your project. If you don’t see your project, make sure you have selected the associated Org. See the Org Switching section below for tips.
Click the Start Building button to trigger your first build. (Previous this step, you must to setup the environment variables)
Find more more information in the CircleCI Docs here.
Setup Environment Variables
- In the CircleCI application, go to your project’s settings by clicking the gear icon on the Pipelines page, or the three dots on other pages in the application.
- Click on Environment Variables.
- Add the SOOS_CLIENT_ID and SOOS_API_KEY variables by clicking the Add Variable button and enter the name and the value provided by the SOOS App as noted in the Integration Steps at the start of this article
You can get more information related to the setup environment variables here.