How can I prevent TFS associating work items with a build? - tfs

I'm trying to set up automatic notifications for our test team so that they're told when they're ready to test a user story.
The notifications are currently firing when the "Fixed In" build for the work item changes.
Our nightly build deploys to a staging server. I want this build to update the "Fixed In" build.
In addition, we have a gated checkin build. I do not want this to update the "Fixed In" build.
I tried changing the "Associate Changesets and Work Items" property in the build definition to "false", but the gated checkin is still being associated with (and updating the "Fixed in" build of) work items.
How can I prevent my gated checkin from being associated with work items?
Is there another smarter way to automatically notify the test team when a work item is ready for testing (as opposed to just having been checked in)?

We have a similar set up, with 'private' builds being fired when developers check in in the DEV branch, and 'integration' builds that are actually the ones that are relevant to the test team.
Both 'private' and 'integration' builds derive from the same build process template, but are different build definitions.
We have constructed in the build solution a custom activity "Types.cs" (basically a simple enum):
namespace BuildTasks.Activities
{
public enum QATypes
{
Private,
Integration,
Release
}
}
This is passed as possible values of an build argument we have added named 'BuildType':
.
This appears now as a configurable build definition parameter:
We obviously enter 'Private' or 'Integration' in each definition accordingly.
In the final steps of our process, we check on the value of this param & depending on it we send (or not) an email to a QA alias.
It might be possible to organize a similar implementation to meet your needs.

Related

Don't Alert when Gated Checkin Fails

We have a team alert in TFS 2015 that sends an email out to all developers whenever one of our builds fails.
I'd like to modify it to not issue emails when someone fails a private build, or a private gated check-in fails (we don't use gated check-ins by default). In these cases, a separate alert will issue to just the individual developer.
Below is the current criteria
However, when I tried to run a manual gated check-in just now, the build failure issued an email to the entire team.
What additional conditions are required to ensure that these emails are not generated when I create a build using a shelveset - whether or not I choose to automatically commit the changes on success.
There is no private gated check-in build, "gated check-in build" is not Private build.
You queue a private build if you want to build the changes that you
have put into a shelveset.
More detail info with private build in TFS, please refer this MSDN link:
Queue a build
When you are going to use the private build and not issue emails when someone fails, you can add a build reason not contain check in shelvest as a workaroud.
The part above your screen shot is the part that identifies if the alert is being configured for a Team (sends to everyone) or a personal alert (just to you).

Using the same TFS build definition for multiple solutions

Our TFS 2013 admins have given us one build definition to build our solution and run all unit tests and they are not willing to create any more build definitions. We are following feature branch strategy and would like to use this build definition for our gated builds. I am trying to find how to use this one build definition with multiple branches.
I know, I can add all branches to Source settings and build them whenever a check-in is made. But I want to find out, if there is any way to add branches to Source settings, but only compile the solution that has been checked in. For example if we add 5 solutions to the Source settings, we want to compile only the solution that has changed rather than all 5 solutions.
You will need to setup an incremental build that only builds the solutions that have changed.
Ideally you will want to setup a build for every branch. You would still use the one build template given to you, but you would define the work-spaces and behavior differently for each branch depending on your needs. However if you do not have that option you can still implement what you are trying to do.
For example if you only want to build the solution that has changed you will set up your build to be an incremental build like the following:
In the "Process" tab update the "Items to build" section to any *.sln or *.*proj
In the "Workspace" section, select only the source control paths of each branch if setting up a build for every branch or select the entire source if that is how you have to do it ($/).
Change the build to an incremental build by changing the Build Process Parameters on the "Process" tab - CleanWorkspace=None
Tag one of the build agents, so that it is the only one used for these incremental builds. Set the build to only use this tagged agent. It is important that the same build agent or set of agents is used for the builds if incremental builds are to work.

TFS, Jenkins and how to update work items with build numbers

We are using TFS and the TFS Build Service. We are considering to migrate the Build service to Jenkins but we came across some issues. According to this site, there are some things that do not work very well with the TFS and Jenkins plugins. All of them we use a lot:
Associated Change sets – Team Build automatically associates a list of change sets that are included in the build
Associated Work Items – Team Build analysis the relationships and also associates Work Items with a build. Indeed it walks the work item tree (parent) and maintains that association in the chain.
Is this still true? We have this scenario:
A developer checks in a code that fix a bug or resolve a User Story. It does that by associating his check in with the work item ID.
His check in triggers a build that will associate the work item with his changeset. For bugs, the build will update the "Integrated in Build" field with the build number. We use this field to know in witch version the bug was fixed.
Is there any way to make Jenkins behave and do what TFS build service does?
Another option is to mix the two using dummy builds on the TFS side that set the records straight and kick-off the Jenkins' builds. Some hints
How to trigger Jenkins builds remotely and to pass parameters and “Fake” a TFS Build.
This approach requires a bit of effort but has many advantages:
No big-bang, use Jenkins opportunistically
Can continue using existing builds
Having a build identifier in TFS allows you an overall monitoring and to use the Test features
I have a VSTS build definition for one of our projects that requires jenkins to build, but we still have all our other products using VSTS natively. To maintain consistency, this build definition triggers a jenkins build. We configured the build definition to not sync code as jenkins will download it (save time) and not to publish the artifacts back to the agent (i have another script for that found here). This allows developers to continue to use git as normal, and the build/release process is consistent with our other products. Along with task tracking and such.

Gated builds - How to not change the Integration Build field?

When I have defined a Gated Build, when somebody checks in code the Integration Build field of a work item changes to the Gated Build number (if the developer associates his check in with work items, of course). Once a CI build is triggered this field changes to the CI build number.
My question is: Is there any way of not changing the Integration Build field of a work item once a Gated Build is triggered?
EDIT
Let me be more clear about how we work.
We have several work itens (some are user stories and some are bugs). When a developer checks in code he or she associates his/her check in with those user stories that gets the Resolved state and a "Gated x.x.x.x" in the integration build field. We never test gated builds. Instead, every night we manually trigger a build and those work itens gets updated again, but this time with a "Release x.x.x.x" in the integration build field. In the next day we test those work itens but the process continues and developers keep check in more US or Bugs (that will have the Gated ...).
Sometime we get confused and we test work itens that should not be tested because they are in the "Gated state".
Even if we have branches that will not solve our problem because the developer associates a check in with work itens and we cant change that.
We do not test gated builds because our QA team is small. The dev team have 20 developers and the QA team have only 2. The process of deploy the application takes about 10 minutes and it can be a pain to wait 10 minutes on every developer check in. Also changing the code while we are testing is never a good idea because it can mess up with our test.
Somebody can think that our process is wrong and suggest a new approach. This will be very welcome, but what we do is working very well besides that small issue.

TFS2010: Disable email alert for private builds

We are taking on new developers and encouraging them to use TFS2010's private builds feature - a build is done using a shelveset, so you can see what impact changes will have.
We have TFS set to email the dev team, and that's what's causing the problem: TFS emails the whole team with the result of the private build, which causes confusion over the current state of the 'public' build when a private build fails.
The only difference in the email is that private builds don't label the sources, so the subject line is Scrum Build 8518 failed rather than Scrum Build CI Build_20111007.5 succeeded. While this is enough to be able to distinguish the two once you're used to it, it's confusing at first.
Is it possible to disable the email alert for private builds? Alternatively, is it possible to change the subject line if the build is private to something more explicit?
I've looked at the JobStatusAgent config and the email templates, but I can't see anything there that will help. We are using the default template, if that's relevant.
Definitely recommend the Alerts Explorer as suggested by #Edward. You don't need the whole team to install the Power Tools, just a couple of team members to manage Project level Alerts should suffice.
With the Alerts Explorer, you can then set up the alert to filter for the Requested By or Requested For fields. In case of Continuous Integration builds, the Requested For field contains the user whose check-in triggered the build. The Requested By field contains the user who requested the build. In case of CI or scheduled builds, this will be the Build Agent service account. Unfortunately, this doesn't really help if you have public builds that are manually requested.
Are you configuring your alerts with the Alerts Explorer power tool? It's much more powerful than the out-of-the-box alerts functionality.
You can configure more fine-grained configuration on the alerts - for example, Title contains " CI ", build number string matching, or based on the person requesting the builds.
Please have a look here, where I 've discribe a method to insert a new build argument named "BuildType" into your Build Process Template.
Using this additional parameter we control the sending (or not) of an email to the QA-team.

Resources