Posts tagged teamcity
Following my previous post regarding a possible design of continuous delivery scheme for an ISV, I’d like to focus today on ThoughtWorks Go. This tool used to be quite expensive but just a few days ago ThoughtWorks made it completely free and open source (under Apache 2.0 license). Because of this dramatic price drop I thought that I would give Go a second chance as try to replicate the same stuff I did with TeamCity. Let me share my insights after spending few days with Go.
The name is probably Go’s biggest problem. It is absolutely impossible to google for any information regarding it. Try ‘NUnit Go‘ for example. Really, these days when choosing name for a product one should think about it’s googleability.
As we’re a .NET shop, I installed Go on my Windows machine. It was quick and easy. Good job here. Same for installing the agents.
Go’s docs are very clean and nice but I have an impression that there’s more chrome than content in them if you know what I mean. Take NUnit integration for example. The only thing I found was the information that Go ‘supports NUnit out of the box’. It turned out that by ‘support’ they mean it can process NUnit’s TestResult.xml file and display ugly (yes, I mean very ugly) test summary on release candidate details page. In order to generate this file I need to run NUnit on my own using the task ‘framework’ (more on that later). Of course I need to install NUnit runner on the agent first.
By the way, there is quite a lot of video how-to’s but personally I don’t think that’s what devs are looking for. On the good side, the HTTP API is very well documented.
Last but not least, I have a feeling that Go’s docs lack transparency a bit, especially compared to Octopus. I mean things like what is the protocol between the server and the agents and why it is secure should be better explained so that I as an ISV can use them to convince my clients to using Go.
Go has a concept of pipeline which lets you define complex build and deployment workflows. Each pipeline has one or more stages executed sequentially, either automatically or with manual approval. Each stage consists of multiple jobs which can be executed in parallel on multiple agents. Finally, each job is a sequence of tasks.
To add even more possibilities, pipelines can be chained together so that completion of one pipeline kicks of another one. Pretty neat. I really like it. The sequential-parallel-sequential design is clean and easy to understand and is expressive enough to implement complex processes and constrained enough to not let these processes become a pile ugly spaghetti.
Go’s agents are universal. They can execute any shell command for you and pass the results back to the server. They have no built-in intelligence like TeamCity (build-specific) or Octopus (deployment-specific) agents and can be used for both building and deploying. Plus they are free. Good job.
Tasks are in my opinion the second biggest (just after the name) failure in Go. A task can be either Ant or NAnt script or… any shell command you can imagine. While I appreciate the breadth of possibilities that come from being able to execute just anything, I really don’t like the fact that I have to do everything myself.
Do you, like me, enjoy TeamCity’s MSBuild configuration UI? Or it’s assembly version patch feature? Or maybe it’s visual NUnit runner configurator? Nothing like this here. To be fair, there is a concept of command repository which allows you to import frequently used command examples but it really isn’t something comparable to TeamCity.
What surprised me is that there seem to be no plug-in system for tasks and for sure no lively plug-in ecosystem. I would expect that if ThoughtWorks made a decision to focus on workflow and agents (which are really good), they would publish and document some API that would allow people to easily write custom task types as plugins. For example, if I would install NUnit plugin into my Go, I would expect NUnit runner to be deployed automatically to my agents.
I managed to build a simple pipeline that does build my source code, packages it up into NuGets (using OctoPack) and runs the unit tests. It’s for sure doable but it’s way more work compared to TeamCity. Because I don’t like a role of release manager who owns the build and deployment infrastructure and prefer teams to own their own stuff, I made a decision to drop Go and focus on TeamCity. It is much friendlier and I don’t want to scare people when I am helping them set up their builds. If ThoughtWorks or the community that will probably form around Go gives some love to defining tasks I will consider switching to Go in future. Go is definitely worth observing but in my opinion, for a .NET shop it is not yet worth adopting.
To be fair, TeamCity is not a perfect tool either. To be able use it we have to overcome two major problems
- No support for defining deployment pipelines (everything is a build type). Bare TeamCity lacks higher-level concepts
- While TeamCity’s base price is reasonable, a per-agent price is insane if one wants to use agents to execute long running tests (e.g. acceptance)
More on dealing with these problems in following posts.
It is quite obvious that all these continuous delivery and deployment automation tools are very good fit for organizations that develop software for themselves, either for internal use or meant to be published in software-as-a-service way. It is not so when it comes to an ISV, which is a Microsoft’s name for a company that uses their tools and platforms to develop custom software for other organizations. I work for Infusion which is more-or-less this kind of company. Big part of our business is developing custom software. We have quite a lot of clients and each engagement is different, also in terms of the responsibilities around deployment and hosting the app. Possible scenarios range from just passing the code (not very frequent), through passing binaries and assisting in production deployment as far as to maintaining the whole infrastructure and taking care of deployments and maintenance on behalf of the client. Clearly, there is no standard way of doing things at Infusion (which is of course good).
One to rule them all
On the other hand, there is a huge need to bring some sanity into the release process. We can’t just reinvent the wheel every single time we approach the go-live date. As part of an initiative aimed to standardize the release process we’ve been evaluating multiple products. One of them is OctopusDeploy. I had a pleasure working with Octopus few times before so I have full confidence in the product. What I want now is to confirm that is can be used in our ISV scenario. The first step was coming out with the following diagram:
The left part of the picture is our ISV. There is a developer there who commits to the source code repository. Then, a CI server (likely to be TeamCity) builds to code and runs the unit tests in the process called Commit Stage in continuous delivery lingo. The Commit Stage is designed to provide short feedback loop to the developers so only the fastest (no DB or any external access) tests can be run as part of it. If this stage succeeds, the second one kicks in where TC asks Octopus to deploy the code to the integration environment. Depending on the concrete scenario, it might be either a single integration tests assembly or a complete application along with some kind of test scripts. Bottom line is, we execute integration tests in this environment rather than on CI server. It allows us to more closely mimic real-world scenarios and also frees up the CI agent when the lengthy tests are being executed.
When tests are done, the result file (an XML) is uploaded and imported into TeamCity. If the results are good, TC kicks off another job that asks Octopus to deploy the app to the internal QA environment where our lovely QA specialists can play with it a bit. Whenever necessary we can easily add more environments/test types to the process (such as performance tests, usability tests) but in most of our projects these two environments should be enough. After the tests are done, the QA engineer can mark the particular build as OK, allowing the Team Lead or the Project Manager to publish the build package to the customer.
Crossing the gap
The publishing format used is NuGet (which is a flavour of Open Packaging Conventions, OPC). In order to achieve desired level of security, NuGet packages are being digitally signed by the build server with our company’s certificate. Although signing is not supported by NuGet, it does not interfere with it in any way. Published packages are transferred to customer’s NuGet repository from which customer’s staff can deploy them to either UAT or production environments.
The deployment process is shared between all the environments on both sides (our ISV and customer) to ensure flawless deployments to production. The process is defined in Octopus and can be synchronized between ISV and customer’s Octopus instance using its great REST API.
Although we are still in the early stages of the implementation, it looks like this process can be without major modifications used to deploy any kind of web application we do (on-premise, Azure-hosted and SharePoint). The key to the success in our initiative is the ability to convince our customers to installing Octopus on their infrastructure. Luckily Octopus has a very thorough documentation with regards to security features it includes that can be used to dispel customer’s fears of automated deployment. The other important thing is the fact that octopus is free for small installations so the initial cost for the customer is close to zero making the entry barrier smaller. We hope that as soon as our customers start using it, they will love it and will include it as first-class citizen in their IT infrastructure.
In the ideal world (for us, an ISV) each our customer maintains their own instance of Octopus along with their environment configuration and release process (e.g. UAT, staging, production) and we agree on standard way of publishing packages and synchronizing the deployment process.