Creating TeamCity Projects
Short module on how to pull repositories from different sources
Last updated
Short module on how to pull repositories from different sources
Last updated
Pulling Public Repositories from GitHub
Pulling Private Repositories from GitLab
TeamCity's projects consist of repositories pulled from public and private sources such as an internal GitLab server, or GitHub. By default, TeamCity will check for updates from the repository every 60 seconds, then pull the latest changes - though this can be changed per project if this is not something that you want/need.
You can also select which branches to pull from - either the default main branch, all branches (by inserting a wildcard *
), or a specific branch such as dev
or nightly
if you're looking for bleeding edge changes.
To create our project, first get a GitHub link (We will use Seatbelt and Ligolo-ng for our demo). On TeamCity, select Create Project -> From a repository URL -> <REPOSITORY LINK> -> Proceed
Make sure you have an internet connection to your server
Add a username and token if you are pulling from a private repository
Next, change the builder configuration name to something memorable or related to the project, and add the branch that you would like to monitor. You can go to the original project's repository to see what the other branches are. Once you're ready, click proceed.
After clicking proceed, you will be met with the configuration page for our builder. TeamCity will automatically detect a build step to use based on our project, but we can change this later
Use the selected build step, then click on edit next to the .NET builder
The compile instructions on Seatbelt tells us to use .NET 3.5 or 4.0 to build our project, and to target release. We will reflect these requirements in our build step.
Set the MSBuild Version to 2019
Set the Required SDK to 3.5
or 4.0
Set the Configuration to Release
Save your changes
Now, we need to specify where our binary will be built. We will choose Seatbelt\bin\Release\Seatbelt.exe
Double check that JDK 17 or 22 are installed on your system
If you do not have any agents, then you can click on Agents from the dashboard, click on Install Agent, then follow the instructions
If everything went well, you should be able to run your build step, and get your first artifact!
If you run into an error on .NET SDK 3.5 not being installed, go to the visual studio installer and add .NET Framework 3.5 Developer Tools from the Individual Components tab and install Microsoft .NET Framework 3.5 Service Pack 1 then restart your VM
If the build is successful, you should see the Seatbelt executable in your artifacts tab, if you cannot find it here then add the C:\BuildAgent
directory to your Defender exclusions (if you've installed an agent post server setup)
You can download the artifact by clicking on its name. You might need to add another exclusion at C:\ProgramData\JetBrains\TeamCity
. We will take a look at how to make the binary less detectable in the next chapter.
Pulling from private repositories is just as easy as from public ones, the only difference is that private repositories must be accessible and you must have the necessary credentials to access them.
If you recall from the previous module, we added our SSH key and created an access token. We will use these to pull the repository - the same can be done for GitHub using Personal Access Tokens or SSH keys.
Let's try pulling our calculator project, then testing and building it using TeamCity
If successful, you should see this screen:
Go to the next section, then click on Build Features - we have to enable the Golang feature to be able to run Go commands
Go back to Build Steps, then in the Command Line option paste this in:
This will run a test on all the folders within the project.
Save and run this step. If the build succeeds, you should see a tab called Tests and the two test cases that we have set in Simple Calculator Project
You can add a second build step after the test with go build ./... -o calculator
to get your executable