I have two different TFS instances. Both use TFVC as a source control.
I want to set up a build definition on TFS1, so that it gets sources from TFS2. Is it possible to do it?
There is no option "Remote TFVC", only "Remove Git".
Thank you.
As far as I can tell, it isn't supported in either TFS On-Prem, or VSTS. Depending on your needs, circumstances and limitations, you might consider one of the following options (all are more or less trade-offs):
Migrate sources from TFS2 to TFS1 (the one to run builds)
This seems to be the correct thing to do, but it is a time-consuming and error-prone process
Fake the Get Sources action and do the real get/checkout in the first build step
You can configure the Get Sources step to address any Git repo in the same team project, and turn the Don't sync sources flag ON. Then, in the first real build step, run command-line Get (something like this)
You may use custom build step (cmd or bat file) and download files from remote server. Examples:
Copy files from tfs versioncontrol to directory with PowerShell
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9559f7a5-405a-456c-a66b-8123d52ed23a/how-to-copy-a-folder-from-tfs-source-control-to-shared-location-with-powershell-script?forum=tfsgeneral
You could just add the extension to get them from an external vsts/tfs.
Go to the marketplace and search for them (see image).
You will have to configure a endpoint to your external vsts/tfs, but it is quit easy to do.
You can install this extension: TFS artifacts for Release Management.
Then add a Download Artifacts-External TFVC task from Utility.
Related
I have a TFS 2015 Build and Release task and as part of this task I would like to take the output from the build and put it on to a server share under the version number of the software.
E.G.
\Server\App\Build\Versions{VersionNo}\
The "Copy and Publish Build Artefacts" tasks does something that is very close to this by setting the drop type to share. The structure isn't exactly what you're after though.
Instead you can also use a standard File Copy task or even a custom powershell script. The name of the build definition and the build version number are available as variables, so it's not hard to create the folder structure you're after.
I'm currently setting up continuous integration using TFS/Visual Studio Team Services (was VS Online), and I'm using the Team Foundation Build 2015 tasks. So not the XAML builds.
I'm using it to build a Xamarin Android project, but that's pretty irreverent I guess,
The process should be like this:
After a check-in:
TFS should download the sources
TFS should increment the version number within AndroidManifest.xml
I've managed to do this by making a PowerShell script for this.
After the AndroidManifest.xml file is modified, it should be committed back into the TFS repository
Then the rest, build deploy into hockeyapp etc
The first steps are all configured, but I'm struggling with the commit part. How do I get TFS to commit the file? I don't really see any task suitable for it. I've tried using the Copy and Publish Build Artifacts Utility - But that did not seem to work, and I'm not even sure if that's the right utility
I'm using the default hosted build agent btw. Any help would be appreciated
Warning
I do want to point out that checking in changes as part of the build can lead to some features of VSTS/TFS not working. Association of work items to the checkin, sources and symbol generation, tractability from changes to build to release and integration with Test Manager, remote debugging, will likely not yield the expected results because the Changeset/commit recorded in te build may not match the actual sources. This may lead to unexpected funny behavior.
Also, if any new changes have already been committed/checked-in after the build has started, the version number may be updated in Source Control for code that was not actually released under that version.
So: First of all, it's considered a bad practice to change the sources from the build process.
Alternatives
There are better ways of doing it, one is to use the build version (Build_BuildNumber or Build_BuildID variables). Alternatively you an use a task like GitVersion to generate the semantic version based on the branch and tag in your git repository. That way your build will generate the correct version number and will increment the revision in case the same sources are built multiple times.
I understand, but I still want to check in my code as part of the build
If these things don't work for you and you still want to check in the changes as part of the build, you can either use the TFVC Build Tasks if you're using TFVC or use the Git Build Tools to add the remote to the local repository and then use the git commandline tools to commit and push the changes back to the repository.
These extensions require TFS Update 2 to install. But you can push the individual build tasks using the tfx commandlien tool. For the TFVC tasks the process is explained here.
On mac
On the mac it's going to be harder since you're using TFVC. My TFVC tasks leverage the TFS Client Object Model and Powershell to communicate to the TFS Server. The tf.exe tool doesn't even work on windows when you're in the context of a build, which is why I need to call into the VersionControlServer object directly. Given I'm dependent on these technologies, the tasks won't run on a Mac or Linux agent.
You could try to see whether the Team explorer Everywhere X-platform commandline works from the build agent (using a shell script). I have no way to test this on an actual Mac.
Given the cross platform nature of your project I'd recommend to move to Git, it integrates into XCode and Android Studio, making it easier to do a native UI or build on top of native libraries.
Alternative 2
You could setup a build which does the required changes to the code and then checks in the modified code. Then have a (CI) build run the Android and the Mac builds using the modified code.
Our plan is to use Team Foundation Build service to do automatic builds, then use the testing facility to automatically perform testing on the build server then release that build onto the application server.
So far we have
Team Foundation Server with TF Build Controller configured
Build server with win2012, Visual Studio 2013 and Build agent configured.
SQL Server with SQL 2013 installed
Application Server with Win2012 and .netframework installed
My question is what do I need to do to set up automatic builds, and to execute the unit test harness once compilation is successful.
Also the deployment target machine will initially be DEV, however we would like to quickly build for test env and prod etc.
This is what I got so far.
Build Controller (Already set up I believe)
Build Agent (Already installed on build server)
Build Process Template (Do I need to do anything with this. Is this what controls the whole lot)
Team Build Definition (I had a look at this, and it seems to use the build process template)
Drop Folder (I am assuming this is where the executables will be dropped into).
At the moment I have bits and pieces of info, what I would like to know is how this whole thing is hanging together. From the moment the developer wants to do the build to the moment that exe is placed into the DEVAPPSERV (Development application server).
Is anyone able to point me in the right direction or give a summary of what I need to make this happen?
Many thanks,
Dalibor
Install TFS Server (TFS Disk) Create a Team Project Collection and any desired Projects
Install TFS Controller + Agents onto a dedicated machine (TFS Disk) Configure only the build options if on a different machine to the TFS Server
Configure Build Controller to connect to a Specific Team Collection on your TFS Server
Install VS Premium or higher on build machine, if you want code coverage results for your tests
Add some code to TFS Source Control
Create a Build Definition using the default template.
Configure the build definition.
Set the working folder for the build, include only what you need as this will speed up the process
Point the definition to your .sln or proj file.
Ensure testing is enabled and that your test assembly names will match the regex used to identify test dll's i.e. name your test assemblies with the word test.
Set the trigger to be CI or what ever flavour of build you require i.e. gated build
Save the build definition
Trigger a manual build and debug any issues
you should have the basics done and a repeatable build created.
That should cover the basics, you may want to customise the build template (see Ewald Hoffman's guide for tips), you may want to narrow down your code coverage (look for runsettings file info).
If you follow these steps you should be able to get a basic build created and running from these, if you hit any issues you can come back and ask specific questions about a particular area
In order to do automatic builds you should check the CI build option ( under the trigger build option ) and third party automated testing can be run by executed by a post build script.
See the following TFS article about post build scripts.
http://msdn.microsoft.com/en-us/library/dn376353.aspx
Currently we have a build process as follows:
I do a build into our dev staging environment.
I label this in TFS.
I use SVN bridge to check out that changeset that was labelled.*
If testing for dev staging passes, I use the working copy I checked out to do another build into the next environment.
I don't want to have to use SVN Bridge to have a copy of my code somewhere else for code at a specific version, but I have not found a way to do this natively in TFS (2010).
Is there a way of doing this (point 3 and 4) using TFS, instead of SVN Bridge?
I may be completely misunderstanding what you're trying to do, but it sounds like you need to create a separate workspace, and get the code that was labeled in step 2 into the new workspace.
We are using TFS2008 and TeamBuid to build our product. I have SolutionAA in TeamProjectAA that uses a file reference to a compiled library (SolutionBB) that is checked in to TeamProjectAA. Now this works fine. Now the source code to the library is checked in TeamProjectBB. The problem arises when I need to due a full build using TeamBuild. I have a build project for SolutionAA but I need to compile SolutionBB and version is correctly so it can be distributed with our install.
Is there a way to chain two TeamBuilds together? Or can I build a solution from another TFS project from another TFS project?
See this post (http://bit.ly/tfschaining) which contains an example Custom Task which can queue a build.
Your full build can start by running build AA and then queue build BB.
I would suggest, though, that you get a better versioning scheme for your dependencies. You are running AA as if it is an independent project and should treat it's output as such in BB. Consider pulling manually from AA as you it suites your status on BB. That way BB can have intermediate builds and BB can only pull when its ready to take on the changes in AA.
I'd suggest checking in the compiled library as part of the TFS Build for SolutionBB. Then, include the location of that compiled library in your workspace mapping for the TFS Build of SolutionAA and configure it with a continuous integration trigger. The build of SolutionAA will get triggered whenever the compiled library for SolutionBB is modified in version control.