building asp .net 5 applications on linux with tfs 2015, part 2: configuring the build agent

4
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. First, get a Linux machine! I used an Azure VM running Ubuntu 14.04 LTS, so these steps should work against a similar setup. Connect to your Linux machine via SSH and log in. If you need an SSH client, PuTTY is awesome and it's all I ever use. Install NPM, the Node Package Manager. We'll be using NPM to install the cross-platform build agent. The following command should take care of it: sudo apt-get install npm Answer "yes" to any prompts that come up. Now, for whatever reason, a lot of the upcoming steps depend on the command "node" being available. But NodeJS installs as "nodejs". So we have to add an alias for "nodejs" to "node": sudo ln -s /usr/bin/nodejs /usr/bin/node Now run the following command to check your version numbers: npm -v && node -v 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! Now we need to install the cross-platform build agent, which is available on NPM. sudo npm install vsoagent-installer -gThat 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:

Upload: incyclesoftware

Post on 15-Jan-2017

279 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Building ASP .NET 5 Applications on Linux with TFS 2015, Part 2: Configuring the build agent

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.

First, get a Linux machine! I used an Azure VM running Ubuntu 14.04 LTS, so these steps should work against a similar setup.

Connect to your Linux machine via SSH and log in. If you need an SSH client, PuTTY is awesome and it's all I ever use.

Install NPM, the Node Package Manager. We'll be using NPM to install the cross-platform build agent. The following command should take care of it:sudo apt-get install npm Answer "yes" to any prompts that come up.

Now, for whatever reason, a lot of the upcoming steps depend on the command "node" being available. But NodeJS installs as "nodejs". So we have to add an alias for "nodejs" to "node":sudo ln -s /usr/bin/nodejs /usr/bin/node

Now run the following command to check your version numbers:npm -v && node -v

You should see output like this:1.3.10v0.10.25

This means that you have version 1.3.10 of NPM and 0.10.25 of NodeJS installed. Perfect! Now we need to install the cross-platform build agent, which is available on NPM.

sudo npm install vsoagent-installer -gThat will download the build agent installer. Now make a directory called "build" and switch into that directory, and run the installer:mkdir buildcd buildvsoagent-installer

You should see some text like this:Installing agent to /home/ictfs-admin/buildCopying: /usr/local/lib/node_modules/vsoagent-installer/agent /home/ictfs-admin/buildCopying: /usr/local/lib/node_modules/vsoagent-installer/node_modules /home/ictfs-admin/buildmaking scripts executableDone.

This step is only if you are using an app tier server name that is not using a FQDNFor example, my server is "ic-tfs-at-01". It's not "ic-tfs-at-01.incyclesoftware.com", or "ic-tfs-at-01.local", or anything like that. That "." matters to the cross-platform agent at the moment; it will not allow you to configure the agent unless there's a "." in there. I submitted a bug fix for this, but it hasn't been merged in yet, so you'll have to do this in the interim. :)My solution is basically to remove the check from the configuration.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.jsFind line 153, it should look like this:

Page 2: Building ASP .NET 5 Applications on Linux with TFS 2015, Part 2: Configuring the build agent

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!

Now we can run the configuration process.node agent/vsoagentIt's going to prompt us for some setup information:- User name - enter your build service account. If you're using a domain, Specify it as USER@DOMAIN, not DOMAIN\USER. For example, my domain is "azure", and my user is "tfs-build". So I'm going to enter tfs-build@azure here.- Password. No explanation necessary.- TFS server URL. So, http://yourServerName:8080/tfs- Agent name. Enter whatever you want, I leave it default.- Agent pool name. If you made a separate agent pool (I made one called 'linux', enter it here.It should look something like this:Enter alternate username > tfs-build@azureEnter alternate password >Enter server url > http://ic-tfs-at-01:8080/tfsEnter agent name (enter sets IC-TFS-BA-03Lin) >Enter agent pool name (enter sets default) > linuxsuccessful connect as undefinedRetrieved agent pool: linux (2)Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_SESSION_ID=1Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SHELL=/bin/bashThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CLIENT=67.85.54.145 4186 22Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_TTY=/dev/pts/0Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap USER=ictfs-adminThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap MAIL=/var/mail/ictfs-adminThu 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/gamesThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap PWD=/home/ictfs-admin/buildThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LANG=en_US.UTF-8Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap HOME=/home/ictfs-adminThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LOGNAME=ictfs-adminThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CONNECTION=67.85.54.145 4186 10.0.2.14 22Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSOPEN=| /usr/bin/lesspipe %sThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_RUNTIME_DIR=/run/user/1000Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSCLOSE=/usr/bin/lesspipe %s %sThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap _=/usr/bin/nodeThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap OLDPWD=/home/ictfs-adminThu 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/gamesThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap ant not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap clang not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap cmake not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap curl=/usr/bin/curlThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap git not found

Page 3: Building ASP .NET 5 Applications on Linux with TFS 2015, Part 2: Configuring the build agent

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 foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap make=/usr/bin/makeThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap mdtool not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap mdtool not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap mvn not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap node.js=/usr/bin/nodeThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap node.js=/usr/bin/nodejsThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap npm=/usr/bin/npmThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap gulp not foundThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap python=/usr/bin/pythonThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap python3=/usr/bin/python3Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap sh=/bin/shIC-TFS-BA-03LinCreating work folder ...Creating env file ...Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_SESSION_ID=1Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SHELL=/bin/bashThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CLIENT=67.85.54.145 4186 22Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_TTY=/dev/pts/0Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap USER=ictfs-adminThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap MAIL=/var/mail/ictfs-adminThu 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/gamesThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap PWD=/home/ictfs-admin/buildThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LANG=en_US.UTF-8Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap HOME=/home/ictfs-adminThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LOGNAME=ictfs-adminThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap SSH_CONNECTION=67.85.54.145 4186 10.0.2.14 22Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSOPEN=| /usr/bin/lesspipe %sThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap XDG_RUNTIME_DIR=/run/user/1000Thu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap LESSCLOSE=/usr/bin/lesspipe %s %sThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap _=/usr/bin/nodeThu Aug 13 2015 14:55:33 GMT+0000 (UTC) : cap OLDPWD=/home/ictfs-adminSaving 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.