In my last post, I explained how to configure your TFS server and agent pools to support Linux build agents.
In this post, I'll be setting up a Linux machine to act as a build agent for an on-premise instance of TFS 2015. The TFS 2015 cross-platform build agent is just a Node JS application, so we have some prerequisites to take care of first.
sudo apt-get install npm
Answer "yes" to any prompts that come up.sudo ln -s /usr/bin/nodejs /usr/bin/node
You should see output like this:
1.3.10
v0.10.25
This means that you have version 1.3.10 of NPM and 0.10.25 of NodeJS installed. Perfect!
sudo npm install vsoagent-installer -g
That will download the build agent installer. Now make a directory called "build" and switch into that directory, and run the installer:mkdir build
cd build
vsoagent-installer
You should see some text like this:
Installing agent to /home/ictfs-admin/build
Copying: /usr/local/lib/node_modules/vsoagent-installer/agent /home/ictfs-admin/build
Copying: /usr/local/lib/node_modules/vsoagent-installer/node_modules /home/ictfs-admin/build
making scripts executable
Done.
Edit "~/build/agent/configuration.js". I use Nano for this, because I'm not old-school enough to understand how to use vi or Emacs.
sudo nano ~/build/agent/configuration.js
Find line 153, it should look like this:
Configurator.prototype.validate = function (settings) {
throwIf(!check.isURL(settings.serverUrl), settings.serverUrl + ' is not a valid URL');
};
Remove that "throwIf" line and save the file. By the time you read this, they may have merged my fix in. If so, proceed!
node agent/vsoagent
It's going to prompt us for some setup information:It should look something like this:
Enter alternate username > tfs-build@azure
Enter alternate password >
Enter server url > http://ic-tfs-at-01:8080/tfs
Enter agent name (enter sets IC-TFS-BA-03Lin) >
Enter agent pool name (enter sets default) > linux
successful connect as undefined
Retrieved agent pool: linux (2)
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_SESSION_ID=1
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SHELL=/bin/bash
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CLIENT=67.85.54.145 4186 22
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_TTY=/dev/pts/0
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap USER=ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap MAIL=/var/mail/ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap PWD=/home/ictfs-admin/build
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LANG=en_US.UTF-8
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap HOME=/home/ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LOGNAME=ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CONNECTION=67.85.54.145 4186 10.0.2.14 22
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSOPEN=| /usr/bin/lesspipe %s
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_RUNTIME_DIR=/run/user/1000
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSCLOSE=/usr/bin/lesspipe %s %s
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap _=/usr/bin/node
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap OLDPWD=/home/ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap ant not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap clang not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap cmake not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap curl=/usr/bin/curl
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap git not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap jake=.
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap java not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap make=/usr/bin/make
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap mdtool not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap mdtool not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap mvn not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap node.js=/usr/bin/node
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap node.js=/usr/bin/nodejs
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap npm=/usr/bin/npm
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap gulp not found
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap python=/usr/bin/python
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap python3=/usr/bin/python3
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap sh=/bin/sh
IC-TFS-BA-03Lin
Creating work folder ...
Creating env file ...
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_SESSION_ID=1
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SHELL=/bin/bash
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CLIENT=67.85.54.145 4186 22
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_TTY=/dev/pts/0
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap USER=ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap MAIL=/var/mail/ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap PWD=/home/ictfs-admin/build
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LANG=en_US.UTF-8
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap HOME=/home/ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LOGNAME=ictfs-admin
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CONNECTION=67.85.54.145 4186 10.0.2.14 22
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSOPEN=| /usr/bin/lesspipe %s
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_RUNTIME_DIR=/run/user/1000
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSCLOSE=/usr/bin/lesspipe %s %s
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap _=/usr/bin/node
Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap OLDPWD=/home/ictfs-admin
Saving configuration ...
2015-08-13T14:55:33.451Z: Agent Started.
To quit the agent, just press Ctrl-C. You can always re-start it by running node agent/vsoagent
again.