Archive

Posts Tagged ‘Team Build’

Install TFS 2015 Build Agent on Premises


In the previous article, I showed how to install and configure Maven on the TFS Build server to build Java applications. This article however applies to either Java or .NET applications. This article is based on the version 1 of Build Agent TFS 2017 has a new build agent that I will blog about in the future.

Download the Build Agent

  • Go to http://<tfsUrl&gt;:8080/tfs/_admin
  • Click on the Agent pools tab
  • Click on Download agent
  • Extract the contents of the zip file to c:\Agents\1

Configure Build Agent as a Service (without executing UI Testing)

TFS Build Agents can run as a service or a user. From my experience, most build agents run as a service. You need to run as a user or interactively, when you have a build that performs UI testing such as Selenium or CodedUI.

  • Open command line
  • C:\Agents\1\ConfigureAgent.cmd


  • I have used the default options. When you enter the tfs url, make sure you add /tfs at the end of the url
  • The default user account is Network Service. You can use domain user account if you need to control the permissions

Configure Build Agent in Interactive mode (to Run Selenium or other UI Tests)

In this case, we need to configure the build agent to run interactively (i.e. answer to install ‘N’ it as a service). I also created a new Pool and called it Interactive to group all the agents that run in interactive mode.

  • Open command line
  • Extract the agent into C:\Agents\2
  • C:\Agents\2\ConfigureAgent.cmd


  • As mentioned above, I am using the new pool which is called Interactive and the agent is not running as a service.
  • When you enter the tfs url, make sure you add /tfs at the end of the url

View Agents on the Web Portal

  • Go to http://<tfsurl&gt;:8080/tfs/_admin/_AgentPool
  • Agents colour coded in green means that that they are online and connected to TFS. Otherwise, they will show in red
  • From this screen you can also disable or delete an agent



Categories: TFS2015, Uncategorized Tags: , ,

Configure a TFS 2015 Build Server for Java


Introduction

TFS 2015 comes with a new build engine. It supports building many programming languages such as .NET, Java, Xcode, Android and other languages. You can even have a build agent on Linux. For more information visit https://msdn.microsoft.com/en-us/Library/vs/alm/Build/feature-overview

In this document, I will show how to configure a build server to run Java Maven builds.

Installing maven

System Requirements (Copied from Maven website)

  • Java Development Kit (JDK) Maven 3.3 requires JDK 1.7 or above to execute – it still allows you to build against 1.3 and other JDK versions by Using Toolchains
  • Memory No minimum requirement
  • Disk Approximately 10MB is required for the Maven installation itself. In addition to that, additional disk space will be used for your local Maven repository. The size of your local repository will vary depending on usage but expect at least 500MB.
  • Operating System No minimum requirement. Start up scripts are included as shell scripts and Windows batch files.

Installing Java

Make sure you install the JDK and not just the JRE. Other than that, the installation itself should be straightforward

Create the Environment Variable JAVA_HOME

  • Go to Control panel –> System and Security –> System –>Advanced system settings –> Advanced –> Environment Variables
  • Add new System variable and enter JAVA_HOME as “the Variable name” and jdk path


  • Restart the machine
  • To test, open commandline and type echo %JAVA_HOME%

Download Maven

At the time of writing this document, Maven 3.3.9 was the latest version of Maven. Download Binary zip archive from http://maven.apache.org/download.cgi. I created a folder at c:\JavaTools to have my Java related tools. I extracted the contents of the zip file into c:\JavaTools folder


Test Maven from commandline by typing c:\JavaTools\apache-maven-3.3.9\bin\mvn -v . If you have all the prerequisites, you should see something similar to the following output

c:\JavaTools\apache-maven-3.3.9\bin\mvn -v

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)

Maven home: c:\JavaTools\apache-maven-3.3.9\bin\..

Java version: 1.8.0_72, vendor: Oracle Corporation

Java home: C:\Program Files\Java\jdk1.8.0_72\jre

Default locale: en_US, platform encoding: Cp1252

OS name: “windows server 2008 r2”, version: “6.1”, arch: “amd64”, family: “dos”

Create an M2_HOME Environment Variable

  • Create M2_HOME system variable with a value of the Maven folder


  • Restart the machine logout and log back in

What’s Next

In the next blog post, I will show how to install and configure Team Build agents in TFs 2015.

Categories: TFS2015, Uncategorized Tags: ,

Fix TFS 2015 Build’s Queue is Empty


Today I wasn’t able to select a queue while creating a build definition or queuing a build using the new build engine that comes with TFS 2015. The drop down was blank.

This problem may occur if you don’t have build queues for your Collection or if you don’t have permission to use the queues in your build definition.

Go to the administration site for your collection

Check if you have queues for Collection

If you do, select your queueà Role à Agent Queue Users à Double click on Agent Queue Users à add users or groups

Otherwise click the “New queue” link to create a new queue

TFS Build 2015 Gated Check-in Announced


In case you missed the news, the Visual Studio product team at Microsoft has announced the Gated check-in support for TFS Build 2015 (aka Build vNext) for TFVC repository. For more info visit

https://msdn.microsoft.com/en-us/Library/vs/alm/Build/news/2016

 

 

 

Categories: TFS2015, Uncategorized Tags: , ,

Maven test runs fail on some machines


Today I got this error when I ran a Maven build with the test goal on the new build server that I configured to compile the Java code.

[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ xxxxxx —
[INFO] Changes detected – recompiling the module!
[INFO] Compiling 67 source files to C:\Sc\ xxxxxx \target\classes
[INFO] ————————————————————————
[INFO] BUILD FAILURE
[INFO] ————————————————————————
[INFO] Total time: 6.551 s
[INFO] Finished at: 2016-02-08T17:31:25-05:00
[INFO] Final Memory: 11M/61M
[INFO] ————————————————————————
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project xxxxxx Compilation failure -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

I have the same .m2 folder as the other build severs. Maven and the JDK are configured properly as well. The only difference turned out to be that this server had a newer version of the Java JDK than the other servers. After inspecting the pom.xml file, I noticed that the maven-compiler-plugin had the javac.exe path hard coded

<plugin>

<artifactId>maven-compiler-plugin</artifactId>

<version>3.1</version>

<configuration>

<fork>true</fork>

<executable>C:\Program Files\Java\jdk1.8.0_66\bin\javac.exe</executable>

</configuration>

</plugin>

I removed the hardcoded path and specified the Java version instead.

<plugin>

<artifactId>maven-compiler-plugin</artifactId>

<version>3.1</version>

<configuration>

<fork>true</fork>

<source>1.8</source>

<target>1.8</target>

</configuration>

</plugin>

You can also follow the instructions at http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-using-different-jdk.html to target multiple versions of the JDK

Categories: Java Tags: , ,

TFS Build: Unable to load task handler PowerShell for task …


While I was trying run a TFS build for the first time on a Windows 2008 R2 SP1 machine, I got the following error

Unable to load task handler PowerShell for task Maven with version 1.0.13

To determine the Powershell version that is installed on your system:

Open Windows Powershell

Type $PSVersionTable.PSVersion

If you have a version that is lower than 3.0, you will need to update to a recent version of Powershell

In my case, I had PS 2.0 installed. I upgraded to PS 4.0 which I downloaded from

http://www.microsoft.com/en-us/download/details.aspx?id=40855

and that fixed my issue

PS: read the installation instructions to determine proper file name to download

 

Categories: ALM, TFS2015 Tags: , , , , ,

Release Management: Communication with the deployer was lost during the deployment (The parameter is incorrect)


At one of my clients, I got this error on Release Management 2015:

Communication with the deployer was lost during the deployment. Please make sure (1) the deployer machine has not rebooted during installation and (2) the component timeout is sufficient to copy the files from the drop location to the deployer machine and install the package.

History:

The Release Management database was migrated from environment to another following the steps at http://blogs.msdn.com/b/visualstudioalm/archive/2014/04/02/need-to-migrating-release-management-server.aspx

I didn’t migrate the machine key because we are only migrating the database and not the server.

Troubleshooting

Open the Deployment Agent log. The default location should be at

C:\Users\<user>\AppData\Local\Temp\Microsoft\ReleaseManagement\14.0\Logs

Where <user> is the user who initiates the build (e.g. your username, build_service user, etc)

In my case, I had the following error

{“ErrorMessage”:”The parameter is incorrect.\r\n”}
12/14/2015 9:20:32 AM – Error – (9528, 9260) – Error while converting string to XDocument: [Data at the root level is invalid. Line 1, position 1.] [   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options)
at System.Xml.Linq.XDocument.Parse(String text, LoadOptions options)
at Microsoft.TeamFoundation.Release.Common.ExtensionMethods.XmlExtensionMethods.ToXDocument(String value, Boolean preserveWhitespace)].

The error doesn’t give a lot of information.

On the Release Management server, take a look at Release Management Services log which is located at

C:\Users\<RM user>\AppData\Local\Temp\Microsoft\ReleaseManagement\14.0\Logs\ReleaseManagementServices.log

Where <RM user> is the username of the RM account

ConfigureRM

In the ReleaseManagementServices.log, I saw the following error

Request http://rmserver:1000/account/releaseManagementService/_apis/releaseManagement/TfsService/DoesBuildExists?tfsServerId=1&teamProjectName=Services&buildDefinition=MyBuild&buildNumber=BuildName-1.1.28.21&api-version=6.0 threw exception: System.Security.Cryptography.CryptographicException: The parameter is incorrect.

The CryptographicException caught my attention. I visited the Release Management release definition and there was an encrypted password field.

Solution

Reenter the password in the password field and start new  a release