Skip to content
A workbench project to experiment with TeamCity build configuration and Portable Kotlin DSL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docker
gradle/wrapper
src
.gitignore
README.md
build.gradle.kts
gradlew
gradlew.bat
settings.gradle.kts

README.md

teamcity-buildconfig-workbench

This is a smiple project to experiment with the TeamCity Portable Kotlin DSL.

It provides all required services in containers that can be run using docker-compose.

The Services included are:

  • TeamCity with one agent as CI/CD tool
  • Gogs to manage git repositories
  • Mailhog to receive mails from TeamCity or Gogs

... Why?

I wanted to experiment with the Portable Kotlin DSL in an isolated environment.

MailHog

A simple mail server with web ui and API.

Gogs (Git-Server)

Leightweight UI to manage git repositories.

TeamCity (CI/CD)

This server can be used for free as long as less than 100 Build configurations (jobs) are defined and no more than 3 agents are used. See JetBrains License Policy for more details.

Setup

Run the init.sh script in the docker directory. This will create the required keys in the docker/keys folder.

Then just run docker-compose up (you may have to do a sudo). To run everything in the background, use the -d option.

You will find more information about docker-compose at: https://docs.docker.com/compose/install/#install-compose

Setup Gogs

On first run Gogs will ask you to complete the installation.

Select the following options:

  • Select the SQLite3 option
  • Replace localhost with gogs on the Domain and Application URL
  • Email Service Settings
    • mailhog:1025
    • gogs@tcworkbench.com
  • Server and Other Services Settings
    • Select Enable Mail Notifications
    • Leave the other options disabled
  • Select OK
  • Log in and create an account via "Sign up now". The first account will be granted admin privileges by default.
  • Add the public ssh key from the docker/keys folder to the SSH-Keys of the user.

Setup TeamCity

  • Click Proceed
  • Select HSQLDB (local database)
  • Accept License and disable anonoymous stats
  • Create the Admin account
  • Go to Administration -> Email Notifier
    • Enter mailhog for the server
    • Set 1025 as port
    • Test Connection. You can choose any email address as the recipient.
  • Add the Agent
    • Select Agents -> Unauthorized (there should be 1)
    • Select the Agent named regular_agent
    • Click Authorize Agent
  • Setup the ssh keys
    • Select the Root Project for example in Administration -> Projects
    • Select SSH Keys on the left-hand menu
    • Pick Upload SSH Keys and upload the private key from the docker/keys folder.

Accessing the repository

Depending on where you want to access the repository you need different URLs for the repository.

To access the repository from TeamCity use the following URL:

ssh://git@gogs:22/<user>/teamcity-buildconfig-workbench.git

The same repository can be accessed from the outside using:

ssh://git@localhost:10022/<user>/teamcity-buildconfig-workbench.git

It seems to be important to explicitly add the port to the url. Otherwise you may get an error claiming that no key can be found.

Be sure to have the private key from the docker/keys folder available to your ssh client when operating with the repository from your machine. Alternatively you can add your default public key to the Gogs account.

You can’t perform that action at this time.