Features

Agentless build steps: API update and support in AWS CodeDeploy plugin

In version 2020.2, we introduced the concept of agentless build steps that can be run outside TeamCity, in third-party services. With this functionality, you can detach an agent from a build even before the build finishes. This helps manage agents more effectively: the earlier an agent gets free from one build, the sooner it can start another build. In the scope of the whole server, it allows running more builds on fewer agents.

To learn more about agentless steps, watch this video.

What tasks can be offloaded to a third party? Common examples are deploying software with services like Octopus Deploy or performing manual QA verification. Some users also run custom scripts to set up an environment on their servers. Every task that does not require a build agent or its software can now be carried out without it.

Builds with agentless steps can be monitored and tracked in the TeamCity UI just like regular builds. To achieve this, an external service needs to report the build process updates to TeamCity. This is done with special service messages sent via the TeamCity REST API protocol. They can be sent from the service code itself or from some intermediary solution, like AWS Lambda. If your service provides webhooks, the intermediary tool can process those, or it can just regularly poll the service and send respective messages to TeamCity. Either way, the implementation requires time and effort. And in some cases, it might even be impossible without reconfiguring the whole setup.

To simplify this task for you, TeamCity 2021.1 extends its Java Open API to allow tracking detached builds on the TeamCity server side. The new DetachedBuildStatusProvider extension can regularly report messages to a build, change its status, interrupt or finish it. You will find more details about it in the TeamCity JavaDoc.

This extension is already used in the recent version of our AWS CodeDeploy plugin. This plugin adds an extra TeamCity runner: it can automatically deploy your built app to EC2 or on-premises instances, with the help of the Amazon CodeDeploy service. Previously, a build agent, running the AWS CodeDeploy step, would always have to wait until the deployment finishes in AWS — technically doing nothing but polling it. Now, it can do a more useful job instead — run another build.
Since version 2021.1, the AWS CodeDeploy plugin will automatically detach a build from its agent at the start of an AWS deployment. The new server-side extension will poll AWS for a build status and report this information in TeamCity.

If you try this plugin or use the new API extension in custom solutions, we will be eager to hear your feedback on them! Stay tuned for more updates coming in our future releases.

Happy Building!

image description