Skip to main content

Trying @teamcity for #ContinuousIntegration - Part 1

Teamcity is a continuous integration software application from JetBrains. I am a Jenkins expert. I use it at work and I go deep into it with custom plugins and custom code to orchestrate builds and deployments. I use CircleCI and TravisCI for my github projects and these are just for fun. All these products are good in their own way. Jenkins is the mother of all CI tools. CircleCI and TravisCI are simpler to use and I really like the speed and agility of these tools. I would use Jenkins for enterprise and CircleCI/TravisCI for open source public domain projects.

I didn't realize that there is a free version of Teamcity until last night and the features are fairly decent. There is a 50% discount for startups and free for open source projects. This is welcoming.


Installation

Jumping right into it. I downloaded the windows version and the installation was fairly simple with the executable, but I could not get it to work. The browser would just show a blank page. I quickly switched over to my favorite way of doing things - Docker - and it worked right away.


docker run -d --name teamcity-server-instance \
-v $HOME/docker-shares/teamcity/server:/data/teamcity_server/datadir \
-v $HOME/docker-shares/teamcity/logs:/opt/teamcity/logs \
-p 8111:8111 \
jetbrains/teamcity-server



Open http://localhost:8111 and you see a very welcoming 'Teamcity First Start' page.


















I kept the installation simple. I chose the internal database option for the database and accepted the license agreement. I created a user account on the next form and I was brought to the settings page which shows off some pleasing features like:


  1. Version control integration
  2. Email, Jabber, IDE and Windows notifier
  3. Some popular plugin choices and tools on the right


















Hello Teamcity

Step 1: Click on 'Projects' link on the top left and click 'Create Project' - 'Manually'.
















Step 2: Enter project details and click 'Create'




Features observed: Very interesting feature titles that I will explore later.


  1. Build Configuration Templates
  2. Subprojects





















Step 3: Build Configuration


Click 'Create build configuration' - 'Manually'.
























I came this far to realize that I cannot do a simple 'echo "Hello Teamcity"'. I have to integrate with a version control system to proceed with this trial.



















Step 4: Integrating with Github


There are two tiny icons below the 'Repository URL' textbox for github or bitbucket. I chose github because I have a few projects there that I could build easily. Click on the 'Github' icon.













We have to register our local teamcity instance with GitHub. This was easier to do on Jenkins, CircleCI and TravisCI.






















Click 'register Teamcity' and create a new application token on GitHub. Just copy paste as stated in the screen above.





















When you click 'Register application', a new client id and client secret are created. Copy paste from github page to the teamcity github connection page and save. This takes you to a connection page instead of taking you back to your project configuration page. Just use the browser's back button to go back to your project configuration page. Now, the github icon will be showing as enabled.

Click on the github icon and sign in with your github credentials.












Step 5: Select project to build and trigger the build


I have a marstime github project. It is a maven project with java code. It is not perfect, not accurate and it is not well written. But, it compiles and runs.
















Select the github project and click create.

























Step 6: Run the build




Click on the dotted button next to 'Run'. Select 'run as a personal build' and 'clean all files in the checkout directory before the build' (Just some good CI habits). Then click on 'Run Build'.
















I was expecting teamcity to start building this code like Jenkins does on the master when it does not have agents. That didn't happen on teamcity. I clicked on 'Run' three times. Now there are three builds in the queue.














I'll have to create a teamcity agent docker container and hook it up to this teamcity server. Coming soon in part 2 of this blogpost.

Popular posts from this blog

Create #VirtualPrivateCloud, NAT Instance and NAT Gateways on @AWSCloud

Create a Virtual Private Cloud, NAT instance and the new NAT Gatweay ... and making it all work. This is a YouTube playlist of three videos.

Cheat sheet to create a #VPC and Subnets on @AWSCloud

One of the critical things to remember for working with a AWS VPC is creating and using it. I had hard time remembering how to do it, so, I wrote down a cheat sheet for myself.  If anyone wants to follow along, just navigate to the VPC page on the AWS Console and start with 'Create VPC' button. Please note that this may cost some dollars if you are not on the free tier. If you are on the free tier and make mistakes, it may cost some dollars. In the steps below, we will be creating the following on a new VPC: An internet gateway One public subnet with routes for accessibility from the internet One private subnet without any routes One EC2 web server with Apache installed in it and serving a sample html page - using the public subnet. One EC2 server with the private subnet and security group that allows access to resources running on the public subnet only.  Create VPC Name tag: myVPC CIDR Block: 10.0.0.0/16 Tenancy: default (Must have default. Otherwise, it

SQL Server tables with JSON

We can indeed store json data as-is into a traditional Microsoft SQL Server database. The document hosted on Microsoft's site left a lot of questions and unknowns that I had to explore and experiment to figure out the right recipe for creating a table to store json, inserting the data as json and querying for the values of individual keys within the json. Here you go:  --Create a table with an identity column and a nvarchat(max) column to store the individual json documents create table dbo.logs (     _id bigint primary key identity,     json_log nvarchar(max) ); --Add a constraint to the json_log column of the table to ensure that the table accepts only json as value to store ALTER TABLE dbo.logs ADD CONSTRAINT [json_log record should be formatted as JSON] CHECK (ISJSON(json_log)=1); --Insert json into the table insert into dbo.logs values ('{"key": "value"}'); insert into dbo.logs values ('{"key": "value1"}'); --Query for al