2

I'm using TeamCity 8.x's EC2 plugin and Agent Push capability to create ubuntu build agents running in AWS EC2. These are created and destroyed on demand.

Is there a way to get custom content into the resulting build-agent's buildagent.properties file, so that, for example, it can know that ansible is installed and what version it is?

I'm looking for a way that this can be totally automated, but TeamCity (v8 at least) doesn't seem to provide any opportunity to customise the file, whether by supplying static content or whether by templating of some sort.

I suppose I could do it via a build itself - but then that would need to trigger off an event that TeamCity does not expose. It would need to happen every time the agent is created.

I could maybe do this by EC2 UserData - except TeamCity doesn't let me customise that.

I could attempt to do this via an on-startup task on the agent - except that would fire before the build-agent software itself is pushed onto the agent.

I suppose I could use incron, to wait for the file to exist before templating in my own content - but can anyone think of a different approach?

Peter Mounce
  • 4,105
  • 3
  • 34
  • 65

1 Answers1

0

You can create environment variables on the AMI before it's baked. When you create a profile for the AMI in teamcity, it will test the AMI and will get the build.properties, environment variables and system properties. You can then use Agent requirements to restrict which builds can run on which agents.

For automating the AMI creation, take a look at packer.

JonSquared
  • 683
  • 6
  • 19
  • Create environment variables as in, `export foo=bar`? With a particular prefix? How would I make those persistent between restarts, put them into `/etc/profile.d/env.sh` ...? Could you please point at some documentation for this? I came up blank. – Peter Mounce Apr 11 '15 at 15:15