Editing TFS release management definitions - tfs

In TFS 2015 update 2, is there a way to copy release definition steps from one environment to another, or from one def to another, or within an environment (to make a clone)? What about multiple selection? Drag and drop only works within an environment, and Ctrl+drag doesn't seem to be supported.
In TFS 2013 Windows-based release client, it was perfectly possible.

I don't have TFS 2015.2 to test your scenario, but I have tested in TFS 2015.3. In TFS 2015.3, you can clone environment, but can't clone release definition. Check the screenshots below:
I also tested in the newest TFS15, you can both clone environment and clone release definition. Check the screenshots below:
So, you can consider upgrading your TFS, then you are be able to clone environment.

Related

TFS 2015 Acknowledge Build

We work with TFS 2015 and it works really great. We have two different build sets one for our production environment and one for our test environment. We also use CI. Our current workflow is that we "Queue build..." and then everything is done automatically.
What we would like to accomplish on our production build is one of the following:
On "Queue build..." the person has to acknowledge the build or
You have to somehow start the queue manually, so the queue build doesn't start automatically
Don't use builds for deployment. If you're on TFS 2015 RTM or Update 1, upgrade to TFS 2015 Update 2 (or, ideally, TFS 2017 Update 1). Starting in TFS 2015 Update 2, there is a Release hub that has exactly the kind of capabilities you're asking for. It allows you to define a release pipeline for the binaries generated by a build, where you can put optional approval requirements in place prior to a deployment occurring on a given environment.

Commit file back to repository from build server in Visual Studio Team Services

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.

Building version branches in TFS with TeamCity

I'm looking at using TeamCity 7.1 as our build server, and I am trying to figure out if it is possible to do what I want.
Our TFS branching looks like this
MyProject
tags
1.0.0.0
1.1.0.0
2.0.0.0
trunk
So our process is to work in the trunk, and when we reach a point where we want to deploy, then we create a branch with that code. In the above example, version 2.0.0.0 is in production, and the trunk has further changes made to it. So if I need to fix a bug in production, then I will fix it in the 2.0.0.0 branch.
I am able to set up a build that checks out the trunk, runs tests, etc., without any problems, and it can be triggered by checkins to the trunk. But I would like to also monitor all the version specific branches, so that when I check in a bugfix in the 2.0.0.0 branch, then a build is triggered, and all my tests are run.
It seems that some of the VCS options have had a new feature added to support this called "branch specification" (https://tom.cabanski.com/2012/11/19/teamcity-7-1-branch-builds-rock/) but that is not available on a TFS VCS root.
Is it possible to do this without creating a separate build configuration for each of my version branches? Or is there a way to manually launch a build of a specific branch, by using my existing build configuration for the trunk?
Since "feature branches" are not supported for TFS in TeamCity (only for Git and Mercurial at this time), creating separate build configurations is the best way to build separate branches. Actually, even for Git and Mercurial creating separate build configurations for long-lived version branches (as opposed to feature branches which come and go) is recommended.
I am not sure how branches are handled in TFS, but if you use tags, I believe there is no way to build off a TFS tag in TeamCity (TW-7370).

How do I migrate source code from one TFS server to another?

We have a TFS 2005 (I think) were we host some code in one domain. Now we would like the customer do host the code by itself and they have bought a new version of TFS 2010. How do I migrate the code from the old server to the new one. We don't care about history at this point since we will have the old system running for at least one year if something critical happen.
What I have done so far is the following:
Create a master branch in the new version and copied the old version to the new version with no problem.
Created a development branch from the master branch.
Now I would like to migrate the development code from the old tfs to the new tfs and this seems complicated.
I first thought it would be as simple as checking out the whole development branch in the new TFS, delete all the files and just paste in the files from the old development branch. But that is not the case.
Maybe there are a simple tool I could use instead?
I know you said that you don't care about history but would you take it if you could get it for free? The best thing to do here is an upgrade, or an import of a Team Project Collection. If you take backups of all of your 2005 databases and restore them on the TFS 2010 data tier you can then run "tfsconfig.exe import". This is the most supported way to get your data from one server to the other.
Follow these steps in the new server:
Create the Master Branch, check-in.
Copy the sources from the old server in the local workspace of the new server at the Master Branch location
Check-in to commit the sources to the new server.
Create the Dev branch from the Master Branch using the latest changeset of the Master branch. This will replicate the whole structure of the Master branch to the Dev one.
Exit Visual Studio
Using the Windows Explorer, delete all the content of the Dev branch in the local workspace of your new server.
Copy the sources from the old server of the Dev branch in the local workspace of the new server at the Dev branch location.
Use the TFPT.EXE ONLINE command of the Team Foundation Power Tools to simulate an offline/online switch that will create the pending changes of the new content of your Dev branch (the files you copied from the old server). Be careful you have everything the way you want it to be in TFS. The command is something like tfpt.exe online /adds /deletes /modify /recurse . (check the help of the command)
Check-in.
Then you'll have the relationship between both branch and the content you want in both.
Have a look at TFS Integration Platform

Get specific versions of TFS code in a different directory

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.

Resources