Skip to content

Instantly share code, notes, and snippets.

@markus101
Forked from guifromrio/teamcity-agent-ubuntu.md
Last active November 15, 2015 01:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markus101/4350aee8eba167bc8efa to your computer and use it in GitHub Desktop.
Save markus101/4350aee8eba167bc8efa to your computer and use it in GitHub Desktop.

How to: Setup Teamcity Agent for nunit tests on Ubuntu 14.04

References:

Install dependencies

sudo apt-get update
sudo apt-get -y install openjdk-7-jre-headles unzip mono-complete nunit mediainfo sqlite devscripts dpkg-sig alien

Download TeamCity buildAgent.zip

wget http://<your-teamcity-url>/update/buildAgent.zip
unzip buildAgent.zip -d buildAgent
chmod +x buildAgent/bin/agent.sh
cp buildAgent/conf/buildAgent.dist.properties buildAgent/conf/buildAgent.properties

Change needed properties inside buildAgent.properties

You may need to set the originally commented ownAddress property to the public machine address Also, don't forget to open the default port (9090) in the Security Group settings.

nano buildAgent/conf/buildAgent.properties

Create the start script

sudo nano /etc/init.d/teamcity

Add the following contents:

#! /bin/sh
# /etc/init.d/teamcity 
# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script teamcity "
    /var/teamcity/buildAgent/bin/agent.sh start
    ;;
  stop)
    echo "Stopping script teamcity"
    /var/teamcity/buildAgent/bin/agent.sh stop
    ;;
  *)
    echo "Usage: /etc/init.d/teamcity {start|stop}"
    exit 1
    ;;
esac
 
exit 0

Give it proper permissions:

sudo chmod 755 /etc/init.d/teamcity

Add it to the startup process:

sudo update-rc.d teamcity defaults

Restart and check that the buildAgent is connected on TeamCity Server.

@PeterKneale
Copy link

typo -> openjdk-7-jre-headles -> openjdk-7-jre-headless

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment