Running MSBuild script from TeamCity fails - tfs

I'm migrating my team's CI from TFS to TeamCity.
As part of my build I need to update a few files and check the changes back to TFS.
I've created a simple MSBuild script that checkout the files, update them and check the changes back in.
The script works great on my machine but when I run it fro TeamCity I get the following error:
TF30063: You are not authorized to access ...
Is there a way I can run only the MSBuild step and another user?
Is there a way to grant TeamCity's Agent the needed permissions to connect to TFS

Did you add the Team City Agent account to the team project security groups in Team Foundation Server?

Related

Jenkins Team Foundation Server Plugin and build

I'm trying to configure Jenkins Team Foundation Server Plugin to our cloud VSTS server .
used Personal access for authenticationtokens gave all scope.
the test in TFS/Team Services show: Success via SOAP API .
but when I start the
build I get : Query returned no result!
I guess this might be related with project path because as i said the test in TFS/Team Services show: Success via SOAP API .
this is how I enter the urls :
Collection URL : https://projectdev.visualstudio.com/
Project path : $/project.Generics/project.Generic
got the project path from VSTS -> Code -> Files
tried adding / DefaultCollection didn't help too
what am I missing?
your help will be appreciated!
Team Foundation Server Plugin can integrate TFS/VSTS source sontrol (Git or TFVC) in jenkins Job, and trigger TFS/VSTS release (not VSTS build).
Details you can find in tfs-plugin README:
This plugin integrates Team Foundation Version Control (also known as
TFVC) and Git to Jenkins by connecting to Team Foundation Server (TFS)
and Visual Studio Team Services (Team Services). It also lets you
trigger a release in Visual Studio Team Services, through a post-build
step in Jenkins.
The "collection URL" looks correct to me.
The "Project path" should be "$/{Project}/{FolderPath}".
In your case, is your project named "project.Generics" and "project.Generic" is a folder in the project?

How do I install prerequisites for TeamCity to connect to Team Foundation Server Version Control?

I've installed the prerequisite (Team Explorer 2013) to the best of my knowledge, but when I try to set up a VCS root to connect to our TFS Version Control server, I continue to get this error message:
"No TFS assemblies were found on the system. Please make sure you have
Microsoft Team Explorer installed. Supported versions: 2015 2013 2012
2010 2008 2005"
The Team Explorer I downloaded from Microsoft just seemed to be a plugin for Visual Studio, which doesn't make much sense as a server-side component. Anyway, I configured a connection to our TFS box within Team Explorer/Visual Studio on my TeamCity server.
So I have two questions that seem to be undocumented by JetBrains:
What does it mean to set up and configure Team Explorer? How can I validate that I have set up and configured Team Explorer on my TeamCity server correctly?
How does TeamCity know how to find the Team Explorer assemblies? Is there some sort of configuration I am supposed to do? Where is this documented?
I guess I'm looking for a true step-by-step set of instructions that make no assumptions about my understanding of TFS or Team Explorer, or any assumptions about what I may have already installed on my TeamCity box.
I've read the two articles on the JetBrains site regarding how to set this up, and they don't cover actually installing and configuring the prerequisites or configuring TeamCity to discover the Team Explorer assemblies it needs.
Team Explorer is the client software that you use to access Visual Studio Team Foundation Server functionality from Visual Studio. You can simply launch Team Explorer on your TeamCity server to create a team project and check in a project, to validate whether it is installed correctly.
I couldn't find any documentation that mentioned how does TeamCity find Team Explorer assemblies. But, based on my understanding, there is no configuration needed to detect Team Explorer. Please make sure your TeamCity server is running under Windows.
If the issue that can't find Team Explorer persists, you can install VS Premium instead of Team Explorer.
Setting up Jetbrains TeamCity for CI with Team Foundation Server:
Install Jetbrains TeamCity
If you are planning on using IIS or TFS on the same server, configure Jetbrains TeamCity to run on a port other than 80 or 8080
Once TeamCity is up and running, you can begin configuring your TeamCity installation for CI Builds.
Log into TeamCity with your user name and password
Create a new TeamCity Project
Create a new build configuration
You will now see a series of build configuration settings that you will have to complete presented in a Wizard-style navigation view.
Enter General Settings
Enter VCS Settings
After entering VCS Settings, Create and attach new VCS Root
Enter the relevant information for your TFS instance
Create a Build Step using Visual Studio as your build runner. You can create as many build steps as you need and specify the order of the steps (similar to a TFS Build Workflow).
For setting up Continuous Integration builds, you will need to specify a Build Trigger. CI Builds will generally use a VCS Trigger that is triggered on each source control check-in.
If you need to pass any parameters to your build, you can configure these in your Build Parameters.
That is all! You can then either run your Builds manually by clicking on the Run button in TeamCity or simply verify that your builds are triggered by the next check-in into TFS.

TFS 2015 build agent failing to sync TFVC

For a specific project in my TFS 2015, a vNext build agent is unable to sync source code from the repository.
Only message I can see in log file is:
Starting: Get sources
Syncing repository: RDW (TFVC)
Workspace Name: ws_d565d474_34;Build\1b470f52-2a65-4b67-a68a-b8c32cebcad5
Done syncing repository RDW to version C283662 (workspace version -1)
Note that "workspace version -1". If I check the work folder on my build agent server is empty (not even created). Still the workspace on TFS side is created (checked with TF).
I checked the permissions assigned to the account I'm running the agent on and all seems fine.
I can't find anything in the log, nor on TFS, nor on agent computer.
It is happening only for one project. I tried with a different build server but the outcome is the same.
Does anyone have any tip on what should I check in order to try to solve this problem?
Thanks
I found the answer to my problem. I had the permission inheritance switched off on the folder in the source control under which all of my branches lied.
I do analyse the problem in a bit more details here http://blog.majcica.com/2015/12/24/tfs-2015-build-agent-failing-syncing-the-repository/
The build agent service account needs to be a member of the Build Service Accounts group.

How to trigger jenkins build when changes are commited to TFS?

I have a maven project in Jenkins (which is a selenium- java project), web-Developers use TFS , I want to execute my selenium tests as soon as developers push their code change to TFS.
If you are using Visual Studio Team Services, then you can store your code in Visual Studio Team Services and continue to use Jenkins for your continuous integration builds. You can trigger a Jenkins build when you push code to your team project's Git repository or when you check code in to Team Foundation version control:
If you haven't already, set up a Jenkins server. If you're setting up Jenkins on-premises, enable HTTPS.
In Jenkins, create a new item. Create the type of build that's appropriate for your project.
Set the URL for your Git repository in Visual Studio Team Services. The URL is in the form https://{VSTS account}.visualstudio.com/DefaultCollection/_git/{team project}.
If you haven't already, enable alternate credentials in your Visual Studio Team Services profile. Be sure to set a secondary user name because you won't be able to use your email account to connect Visual Studio Team Services to Jenkins.
Go to your team project's administration page. On the Service Hooks tab, create a subscription. Add Jenkins.
Pick the event from Visual Studio Team Services that you want to trigger a Jenkins build.
Configure the action to take in Jenkins. Now, when that event occurs in Visual Studio Team Services, your Jenkins build will be triggered.
Check:https://www.visualstudio.com/en-us/get-started/integrate/service-hooks/jenkins-and-vso-vs

Can I host the code on TFS cloud and build locally

I want to use existing TFS build scripts but move my code to the TFS cloud.
Can this be done?
Is it as simple as changing the "Source Control Folder" in the Build Definition? (I doubt it).
We have a local build machine which I want to use as it has custom installations required for the build to succeed.
You can. If you install and configure a TF Build Controller locally you can connect it to VSO. Add some agents and you can build hapily locally with all you code safe and secure in the cloud.

Resources