TeamCity is one of the popular Build Automation tools and requires running of the Server and agent.
There are different ways of installing it which you can read more about here. This document specifically lists out the steps of running it locally.
Note: This doc covers basic steps to get the Teamcity and snyk security plugin set up and running.
Docker to be installed and present on your machine.
- Create mapping directories for the teamcity/data, teamcity/logs and teamcity/conf
cd
to the directory where you want to set your teamcity configs and then run the following commands
mkdir teamcity/data
mkdir teamcity/logs
mkdir teamcity/conf
- Copy the above
docker-compose.yml
in the same directory - Run
docker-compose build
- Run
docker-compose up
The above command will spin up the teamcity agent
and teamcity server
and now you can access your Teamcity set up by accessing the http://localhost:8111
on your browser.
Note: To add Snyk security plugin in Teamcity, navigate to Administration > Server Administration - Plugins. Next Browser plugins and search Snyk security - then hit Get 😄
Note: the following steps would come in once you have logged in to your teamcity server, set up a project (Admin - Create project) and are setting up Snyk as one of the build steps.
- Go to your Buids - Edit configuration - Build Steps
- Select
Parameters
from the left pane and SelectAdd New Parameter
- In the dialog box provide the vairable name as
SNYK_TOKEN
and as value provide the API token and hitSave
- Now that your parameter is set up, come to the Build Steps and click the
Add Build Step
Button - Select Snyk Security - set up the fields as per your requirements; For the
Snyk API Token
field click on the small icon next to the textbox for the drop down to appear and select theSNYK_TOKEN
- Hit
Save
- You are now good to run your Build!
Note: You want to always add the Snyk security step after the dependencies have been installed for Snyk to test the open source dependencies. And hence, under execute step the value would be - if all previous steps finished successfully.