My build script depends on the MSBuild Community Task targets. I'd like to make this an agent requirement. How can this be done in TeamCity 8.x?
What you can do is add an Agent Requirement (Step 8 of your build Configuration)
Now immediately after doing this your build agent will be incompatible - that is because there is no such environment variable as MSBuildCommunityTasksPath - I've made this up because Community Tasks does not install any.
The next thing you need to do is log into the build agent PCs that do have Community Tasks installed and add this environment variable:
the path should be either
C:\Program Files (x86)\MSBuild\MSBuildCommunityTasks
or
C:\Program Files\MSBuild\MSBuildCommunityTasks
nb techincally it doesnt matter what you enter as this variable is just a flag indicating community tasks is installed
after you do this you need to restart your build agent
Now this paramter will be available in TeamCity and your build agent should be compatible. You can go to the Agents tab to check this. Agents -> <your agent> -> Agent parameters -> Environment Variables
Related
I have setup the Build pipeline in Azure-DevOps to generate build of xcode automation project. For that, I have used Microsoft hosted MacOS agent on my macbook. Now, i want to setup release pipeline to kick off automated test scripts from TFS/Azure-DevOps Server on the same macBook? Not sure what are the configuration I need to use in release pipeline task. If someone has done this, could you please help me step-by-step?
Did you mean you want the automated test from azure devops to run against your local macBook.
If this is your intention. You may need to setup a self-hosted macOS agent on you local macBook.
Please check here to create a self-hosted agent.
And in the release pipeline, associate your release pipeline to the build artifacts from your build pipeline. Make sure the build artifacts include your test code.If not you may need to add a publish artifact task in your build pipeline to include your test code in the build artifacts which will be downloaded and used in release pipeline.
In your stage create an agent job with the agent pool set to your agent pool with your self-host agent. And add a xcode task to run your test. When you run the release pipeline the test will run on your local macBook.
Here is documents about how to build, test and deploy with xcode. Hope you find above helpful.
Is there a way to restrict build agents to those which only have a particular Powershell module(s) installed?
define which agent has this module
edit the buildagent.properties, add environment variables hasmodule=true
env.hasModuleEnvVar=true
Open the configuration settings -> Agent Requirements
Add new requirement
Parameter Name = env.hasModuleEnvVar
Contains true
Now you restricted your configuration, and it will be run only agent's which contains this module
What's the correct way to setup maven on a Team Services Default build agent?
What I have done so far:
I have downloaded the agent on a virtual machine
I have manually installed java and maven on that machine (C:\Java\jdk1.8.0_101 resp C:\Java\maven\apache-maven-3.3.9)
I have added a few environment variables (maven, MAVEN_HOME, M2_HOME)
after that I install the agent using the powershel script .\config.cmd
The agent gets succesfully registered in my visualstudio.com environment, but the maven capability does not get picked up:
After reading several other posts, I manually added the "maven" capability to the agent:
After all this I can start a build that requires maven. But unfortunately the build fails:
How do I get maven to work properly on my default build agent? I cannot find a solution in the MS documentation.
To answer my own question. The mistake that I made was that I created the environment variables as user variables instead of system variables. To sum things up, here's what's needed:
download the agent on a virtual machine
installed java and maven on that machine
add SYSTEM environment variables M2_HOME and JAVA_HOME
install the agent using the powershel script .\config.cmd
Download the agent on a virtual machine
Install java and maven on that machine add SYSTEM environment variables M2_HOME and JAVA_HOME
Run 'path' in command prompt and ensure that the maven installation directory is listed.
Ensure the maven is installed in 'C:\Program Files\Maven'.
Install the agent using the powershel script .\config.cmd.
Restart server or Update agent from Devops Portal.
In my case I have installed in C drive on root and getting error.
I have a release configured in Visual Studio Team Services using Release Management to run a SonarQube for MSBuild task. The task starts and then fails with the following error:
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\SonarQubePreBuild\1.0.29\SonarQubePreBuild.ps1
[error]Exception calling "GetFullPath" with "1" argument(s): "The path is not of a legal form."
Is this an error that I'm causing or is this an issue with the task?
"SonarQube for MSBuild" is currently designed to use in "Build" process. So you will see some errors when use it in Release Management. You can submit a feature request on this page: http://visualstudio.uservoice.com/forums/330519-team-services
If you do want to use it in Release Management for now and your are using your own build agent rather than the hosted build agent. You can go to the "Tasks" folder in your build agent directory and update the "Path" variables in the PowerShell script for SonarQube task.
For example, changing the path variable "$env:BUILD_SOURCESDIRECTORY" to "$env:SYSTEM_DEFAULTWORKINGDIRECTORY" in "SonarQubePreBuildImpl.ps1", you will get the SonarQubePreBuild task finished successfully.
I'm using TeamCity 8 to run a msbuild script.
I thought TeamCity would set an environment variable or msbuild property with the vcs root url. But I can't find it.
I've tried running the script with /v:diag to get more info, and still can't find any property.
Can I get the url from Teamcity or do I have to run something like svn.exe info?
Here is what I'm currently doing.
TeamCity does have the variable, it's named %vcsroot.url%, but it's available to scrips as default.
To make it available in the msbuild script (and other types as well).
Goto project settings -> Parameters -> Add new parameter
Name: system.vcsroot.url
Kind: System property
Value: %vcsroot.url%
And you have property as $(vcsroot_url) in msbuild