Learning Continuous Integration with TeamCity
()
About this ebook
Related to Learning Continuous Integration with TeamCity
Related ebooks
Learning Continuous Integration with Jenkins Rating: 0 out of 5 stars0 ratingsLearning Node.js for .NET Developers Rating: 0 out of 5 stars0 ratingsReSharper Essentials Rating: 4 out of 5 stars4/5Building Websites with VB.NET and DotNetNuke 4 Rating: 1 out of 5 stars1/5Mastering JBoss Enterprise Application Platform 7 Rating: 0 out of 5 stars0 ratingsGo Programming Blueprints Rating: 0 out of 5 stars0 ratingsTypeScript Blueprints Rating: 0 out of 5 stars0 ratingsNode Web Development, Second Edition Rating: 0 out of 5 stars0 ratingsDevOps with Windows Server 2016 Rating: 0 out of 5 stars0 ratingsMastering Web Application Development with Express Rating: 0 out of 5 stars0 ratingsProgramming Windows Workflow Foundation: Practical WF Techniques and Examples using XAML and C# Rating: 0 out of 5 stars0 ratingsjQuery Design Patterns Rating: 0 out of 5 stars0 ratingsNode.js 6.x Blueprints Rating: 0 out of 5 stars0 ratingsAngularJS Web Application Development Blueprints Rating: 0 out of 5 stars0 ratingsTeamCity A Clear and Concise Reference Rating: 0 out of 5 stars0 ratingsMastering Ninject for Dependency Injection Rating: 0 out of 5 stars0 ratingsSwift 2 Design Patterns Rating: 0 out of 5 stars0 ratingsCRYENGINE Game Development Blueprints Rating: 0 out of 5 stars0 ratingsRedmine Cookbook Rating: 0 out of 5 stars0 ratingsNginx Troubleshooting Rating: 0 out of 5 stars0 ratingsMariaDB High Performance Rating: 0 out of 5 stars0 ratingsKubernetes Secrets Management Rating: 0 out of 5 stars0 ratingsInstant StyleCop Code Analysis How-to Rating: 0 out of 5 stars0 ratingsJavaScript Mobile Application Development Rating: 0 out of 5 stars0 ratingsDevOps Tools Standard Requirements Rating: 0 out of 5 stars0 ratingsXamarin Mobile Application Development for Android - Second Edition Rating: 0 out of 5 stars0 ratingsGoogle Cloud Platform GCP Third Edition Rating: 0 out of 5 stars0 ratingsRestlet in Action: Developing RESTful web APIs in Java Rating: 0 out of 5 stars0 ratingsDocker Complete Self-Assessment Guide Rating: 0 out of 5 stars0 ratings
Internet & Web For You
Beginner's Guide To Starting An Etsy Print-On-Demand Shop Rating: 0 out of 5 stars0 ratingsThe $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5Cybersecurity For Dummies Rating: 4 out of 5 stars4/5More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5Wireless Hacking 101 Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5Coding For Dummies Rating: 5 out of 5 stars5/5Mike Meyers' CompTIA Security+ Certification Guide, Third Edition (Exam SY0-601) Rating: 5 out of 5 stars5/5C++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsHacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Six Figure Blogging In 3 Months Rating: 4 out of 5 stars4/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5How To Start A Podcast Rating: 4 out of 5 stars4/5The Designer's Web Handbook: What You Need to Know to Create for the Web Rating: 0 out of 5 stars0 ratingsThe Mega Box: The Ultimate Guide to the Best Free Resources on the Internet Rating: 4 out of 5 stars4/5How to Disappear and Live Off the Grid: A CIA Insider's Guide Rating: 0 out of 5 stars0 ratingsSEO For Dummies Rating: 4 out of 5 stars4/5How To Make Money Blogging: How I Replaced My Day-Job With My Blog and How You Can Start A Blog Today Rating: 4 out of 5 stars4/5Six Figure Blogging Blueprint Rating: 5 out of 5 stars5/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5Wordpress for Beginners: The Easy Step-by-Step Guide to Creating a Website with WordPress Rating: 5 out of 5 stars5/5From Nothing Rating: 5 out of 5 stars5/5Get Rich or Lie Trying: Ambition and Deceit in the New Influencer Economy Rating: 0 out of 5 stars0 ratingsThe Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5
Reviews for Learning Continuous Integration with TeamCity
0 ratings0 reviews
Book preview
Learning Continuous Integration with TeamCity - Manoj Mahalingam S
Table of Contents
Learning Continuous Integration with TeamCity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction
Introduction to Continuous Integration
Practices
Benefits
Continuous deployment and Continuous Delivery
The build pipeline
Introduction to TeamCity
Licensing
Features
First-class support for various technologies
Lots of plugins
REST API
Comprehensive VCS support
A nice dashboard UI and build history
Ease of setup and comprehensive documentation
Build pipeline/chains
Agents and build grids
IDE integrations
TeamCity and its competitors
Jenkins
ThoughtWorks' Go
Summary
2. Installation
Installing on Windows
Installing the server and the default agent
Installing additional agents
Installation on Mac OS X
Running the TeamCity server and the default agent
Setting up the TeamCity server as a daemon
Installing additional agents
Installation on Linux
Running the server and the default agent
Running the TeamCity server as a daemon
Installing additional agents
Summary
3. Getting Your CI Up and Running
Introducing version control systems
Centralized versus distributed VCSs
VCSs and CI
VCS used in this book
Setting up CI
The sample project
Creating a project in TeamCity
Subprojects
Adding build configurations
VCS roots and VCS settings
Introducing the build steps
Running our first build
Build failure conditions
Triggering the build on VCS changes
Build chains
Deploying to Heroku
Adding functional tests
Parameters and build parameters
Setting up the build chain
Snapshot dependencies
The Finish build trigger
The Build chain view
Fine-tuning our setup
Adding coverage and unit test reports
Publishing reports as artifacts
XML report processing
Report tabs
Build and project statistics
Shared resources
Agent Requirements
Summary
4. TeamCity for Java Projects
Using Ant with TeamCity
Installing Ant
Building with Ant build files
Building with Ant in a build configuration
Adding some unit tests
Setting up code coverage
Build scripts versus TeamCity features
System properties and Ant
Using Maven with TeamCity
Installing Maven
Creating a Maven project
Introducing the Project Object Model (POM)
Building the project
Using Maven in a build configuration
Setting version number
Setting up code coverage for our build
Maven on TeamCity, beyond the build runner
Creating a Maven build configuration
Global Maven settings file
Setting up Maven-based triggers
Using Gradle with TeamCity
Installing Gradle
Building with Gradle on TeamCity
Introducing database migration tools
Summary
5. TeamCity for .NET Projects
Getting started with NAnt on TeamCity
Installing NAnt
Building NAnt with NAnt
Building on TeamCity
Adding NUnit report processing
Configuring agent requirements
Building with MSBuild
Installing MSBuild
Starting an MSBuild project
Building with MSBuild on TeamCity
Adding an NUnit build runner
Running NUnit tests using NUnit task
Running NUnit tests using the task provided by TeamCity
Configuring code coverage with MSBuild
NuGet and TeamCity
Installing the NuGet command-line client
Installing NuGet.exe on TeamCity agents
TeamCity as a NuGet server
NuGet-based build runners
NuGet dependency trigger
Introducing PowerShell
PowerShell-based build tools
PowerShell build runner in TeamCity
Database migrations with .NET
Summary
6. TeamCity for Ruby Projects
Getting started with Rails
Managing Ruby versions
Introducing Bundler
Installing Rails using Bundler
Introducing Rake
Setting up the build on TeamCity
Setting up Ruby interpreter
Running Capybara- and Selenium-based feature tests
Summary
7. TeamCity for Mobile and Other Technologies
CI for Android projects
Generating the APK
Running Calabash tests
Building iOS projects on TeamCity
Installing TeamCity plugins
Installing the Python runner plugin
Building with the Python build runner
Introduction to TeamCity.Node plugin
Summary
8. Integration with Other Tools
IDE integrations
IntelliJ platform IDEs integration
Installing the plugin
Configuring notifications
Managing projects from the IDE
Opening files and patches in IDE
Remote Run
Visual Studio integrations
GitHub integrations
GitHub webhooks and services
Using the TeamCity.GitHub plugin
Support for pull requests
Integrating with GitHub issue tracker
Build monitors
Team Piazza
Project Monitor
Build lights
Notifications
Summary
9. TeamCity for a Member of the Team
Managing projects of interest
Hiding projects
Hiding build configurations
Navigating across projects
Investigating investigations
Assigning investigations
Viewing active investigations
Managing current and muted problems
TeamCity universal search
Actions on build configurations
Pausing triggers in a build configuration
Checking for pending changes
Enforcing clean checkout
Summary
10. Taking It a Level Up
Build configuration templates
Creating templates from scratch
Creating build configurations from the template
Creating templates from existing build configurations
Going meta with Meta-Runners
Using Meta-Runners
Build result actions
Commenting on build results
Tagging build results
Pinning build results
Promoting builds
Marking the build as successful or failed
Removing builds
Build history cleanup
Cleanup rules
Archiving projects
Configuring build priorities
Interacting with TeamCity from build scripts
Service messages
Creating teamcity-info.xml
Summary
11. Beyond CI – Continuous Delivery
What is Continuous Delivery?
Why Continuous Delivery?
The deployment pipeline
Implementing the deployment pipeline in TeamCity
Publishing and consuming artifacts
Build chain for CI
Deploying to environments
Environments as gates
Identifying the build that is deployed in an environment
Deploying any version to an environment
Limiting deployment permissions to certain users
Passing sensitive information during deployment
Feature branching and feature toggling
Summary
12. Making It Production Ready
Using TeamCity with an external database
Configuring PostgreSQL as an external database
Migrating from one database to another
Backup and restore
Taking backups from the server UI
Backing up and restoring data using the maintainDB tool
A manual backup
Handling upgrades
Updating a server installed via an archive
Updating TeamCity using the Windows installer
Updating the agents
Monitoring resource usage, performance, and logs
Disk space usage
TeamCity server diagnostics
Tweaking the TeamCity JVM
Summary
Index
Learning Continuous Integration with TeamCity
Learning Continuous Integration with TeamCity
Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August 2014
Production reference: 1190814
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84969-951-8
www.packtpub.com
Cover image by Tony Shi (<shihe99@hotmail.com>)
Credits
Author
Manoj Mahalingam S
Reviewers
Mark Baker
Evgeny Goldin
Scott A. Lawrence
Eugene Petrenko
Commissioning Editor
Usha Iyer
Acquisition Editors
Sam Birch
Ellen Bishop
Content Development Editor
Govindan K
Technical Editors
Neha Mankare
Shiny Poojary
Akash Rajiv Sharma
Copy Editors
Sarang Chari
Gladson Monteiro
Project Coordinators
Aaron S. Lazar
Sageer Parkar
Proofreaders
Simran Bhogal
Maria Gould
Ameesha Green
Paul Hindle
Indexers
Hemangini Bari
Tejal Soni
Priya Subramani
Graphics
Ronak Dhruv
Abhinash Sahu
Production Coordinators
Saiprasad Kadam
Nilesh R. Mohite
Cover Work
Saiprasad Kadam
Nilesh R. Mohite
About the Author
Manoj Mahalingam S is an Application Developer and Devops engineer at ThoughtWorks Inc., where he started his career five years ago. He mainly codes in C#, Python, and Ruby. He likes to think he knows Haskell, but maybe he doesn't. He is also extremely fond of PowerShell and is the author of the PowerShell-based build-and-release framework, YDeliver (https://github.com/manojlds/ydeliver).
He has employed Continuous Integration and Continuous Delivery in a number of projects, ranging across all the major tech stacks. He has also spoken at a number of conferences, including Pycon India and Devopsdays India.
He can be found answering questions on Stack Overflow at http://stackoverflow.com/users/526535/manojlds and also contributing to a number of projects on GitHub. He blogs at http://www.stacktoheap.com.
I would like to thank my wife, Gayathri, for supporting me and for helping me squeeze out the extra time needed to finish this book.
I would also like to thank my mother Mythili, my father Swaminathan, and my sister Priyanka for all their support and well wishes.
Finally, I would like to thank my employer, ThoughtWorks Inc., and also all my colleagues without whom I would not have had the knowledge and the experience to write this book.
About the Reviewers
Mark Baker is the Technology Lead of Tools at Mind Candy, home of the BAFTA-winning Moshi Monsters. His team is responsible for workflow and tools at Mind Candy and is dedicated to improving the quality of life for content creators and software developers.
Mark has been developing video games since 1998 and has worked for many game companies, such as Disney, Electronic Arts, and Sony Computer Entertainment, in a variety of roles, often concentrating on tools and infrastructure. He has contributed to multiple critically acclaimed games on different console systems. He has written a regular column on programming issues for the Develop magazine and presented papers at many industry conferences.
Evgeny Goldin is a Java, Groovy, and Scala developer who turned into a build, release, and deployment engineer to introduce order where chaos usually reigns. He's an open source developer, speaker, and passionate advocate when it comes to automation tools and techniques.
I'd like to thank my lovely wife, Inna Goldin, for giving her love and support and making this project happen.
Scott A. Lawrence is a software developer currently developing healthcare IT solutions in the Washington, D.C. metropolitan area. After graduating with a Bachelor of Computer Science degree from the University of Maryland, College Park in 1992, he's developed software solutions using Microsoft technologies for customers in various fields, including healthcare, marketing, e-commerce, as well as federal contracting for civilian and defense/intelligence agencies.
Eugene Petrenko is a passionate software developer and consultant. In 2009, he defended his PhD thesis in Computer Science. For more than 12 years, he has been working in many fields including .NET, Java, Windows APIs, server-side technologies, Spring Framework, Android, and Kotlin. He has been working for JetBrains since 2004. As a TeamCity team member, he has developed many core features. He has deep knowledge of the product and its internals. He is the author of several popular open source plugins for TeamCity, such as NuGet support, TeamCity.GitHub, TeamCity.Node, and TeamCity.Virtual.
Eugene also has a blog at http://blog.jonnyzzz.name.
www.PacktPub.com
Support files, eBooks, discount offers, and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
http://PacktLib.PacktPub.com
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print and bookmark content
On demand and accessible via web browser
Free access for Packt account holders
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.
Preface
Continuous Integration (CI) has become mainstream in software development. Accordingly, the number of CI tools has increased as well. TeamCity by JetBrains is one of the leading CI tools available today, and it is suitable for small teams, large enterprises, and everyone in between. Being a flexible and feature-rich tool, it is also necessary to understand which features should be used, and which shouldn't, based on the specific context.
Learning Continuous Integration with TeamCity is a comprehensive guide to get started with CI, TeamCity, or both. With the goal of understanding CI and its benefits and utilizing TeamCity to realize the said benefits, the book uses sample projects and examples to explain how to set up CI. The projects are from the major tech stacks such as Java, .NET, Ruby, Python, Android, iOS, and more. The chapters also discuss the myriad tools in each of these ecosystems that are essential for a beneficial CI setup.
Every aspect of CI, the processes, tools, and the collaboration amongst the people is covered in terms of features offered by TeamCity. The book also takes a look at what's beyond CI—Continuous Delivery (CD)—and how TeamCity fares in setting up a fully functional CD setup.
What this book covers
Chapter 1, Introduction, discusses CI and its basic practices. The idea is to be on the same page when we discuss CI in the rest of the book and when implementing various solutions using TeamCity as a CI server. This chapter will also provide a high-level introduction to TeamCity, its features, and how it compares with competing products, such as Jenkins and ThoughtWorks's Go.
Chapter 2, Installation, discusses the installation of TeamCity, the server, and the agent. The aim of this chapter is to get started with a basic installation of TeamCity that can be used to configure and run the builds in the upcoming chapters.
Chapter 3, Getting Your CI Up and Running, comes up with a complete CI setup. We will start with a brief introduction to version control systems and the important role they play in CI. We will then pick up a sample project and set up CI for it. After getting a fully functional CI setup, we will explore some fine-tuning options that we have at our disposal. In the process, we will learn about the TeamCity terms, features, and concepts involved.
Chapter 4, TeamCity for Java Projects, covers the specific features that TeamCity provides for setting up CI for Java projects.
Chapter 5, TeamCity for .NET Projects, introduces the various tools present in the .NET ecosystem and also TeamCity's integrations with these tools.
Chapter 6, TeamCity for Ruby Projects, explains the various tools involved in setting up CI for Ruby projects. We will be covering RVM, rbenv, bundler, rake, and RSpec. We will also look at how these tools come together and integrate with features provided by TeamCity.
Chapter 7, TeamCity for Mobile and Other Technologies, explains how TeamCity fares when it comes to mobile projects, specifically Android and iOS projects. We will also look at some plugins for TeamCity and how they extend TeamCity to provide first-class support for even more platforms such as Node.js.
Chapter 8, Integration with Other Tools, teaches how TeamCity provides integrations with various tools, with the aim of making CI and interacting with TeamCity, a seamless experience.
Chapter 9, TeamCity for a Member of the Team, discusses how a user of TeamCity can take advantage of the features provided by the web interface of TeamCity to achieve various tasks that are expected of them in a CI setup.
Chapter 10, Taking It a Level Up, explains some of the more advanced concepts in TeamCity. These concepts can improve the entire setup of TeamCity and aid in moving towards a better CI setup.
Chapter 11, Beyond CI – Continuous Delivery, teaches us to expand on the concept and explores how a CD setup can be achieved using TeamCity. First, we begin by looking at what CD is and why it is beneficial. Then, we look at how the Deployment Pipeline can be configured in TeamCity so as to achieve these benefits of CD.
Chapter 12, Making It Production Ready, explains some of the steps needed to make our TeamCity installation ready for the real world.
What you need for this book
Depending on the tech stack/platform being used, a Windows/OS X/Linux based computer may be required.
For Java, a recent version of JDK 1.7 might be required. The .NET framework 4.0 will be needed for the .NET chapter.
Much of the installation of various tools and frameworks, including TeamCity, is covered in the book.
Who this book is for
Learning Continuous Integration with TeamCity is intended for teams and organizations comprising developers, testers, and operations and Devops, who are trying to start practicing CI, start using TeamCity, or both. If you have thought about bringing CI in to your team, if you are already using a CI tool and want to move to TeamCity, or if you are looking for ideal practices and techniques while implementing CI with TeamCity, this book is for you.
Since the book covers all major platforms/languages, such as Java, .Net, Ruby, Python, and even mobile, your project is most likely covered in the book.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: An init script can be added and enabled for the agent, similar to the one for the server, in order to run it as a daemon.
A block of code is set as follows:
cover => coverage
nosetests.xml
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd
>
Any command-line input or output is written as follows:
wget http://www.trieuvan.com/apache/ant/binaries/apache-ant-1.9.3-bin.tar.gz tar xvfz apache-ant-1.9.3-bin.tar.gz export ANT_HOME=~/Downloads/apache-ant-1.9.3
export PATH=$PATH:$ANT_HOME/bin
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: If you choose to install the agent, next comes the Configure Build Agent Properties screen.
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you