Automated Builds on Branches for TFS - tfs

In TFS, you are able to create automated builds and create branches (well, hopefully. ;) )
I have the following structure:
->Trunk
->Branches
-> Branch A
If you create an automated build, you are able to create a trigger for the build. In my case I want to create a build for Branch A so that when a checkin occurs Branch A is built. However, if I do a checkin in the Trunk, my automated build will start as it detected a checkin. Is there anyway that I can do builds per branch?

Make sure your workspace for the branch in the build definition is set to the branch only and not to the root of your project. My guess is that TFS does file change detection by workspace. You'd want it set to $Project/Branches/Branch A in your example.

Related

Delete not recently run jobs from Jenkins

In part of our testing setup we are build our artifacts needed and then copying a template job and settings its name so it recognizable.
Build artifact -> copy test template -> ending with a job for each
test case
that means i'm ending up with lots of jobs with Test_Client${BRANCHNAME}_Server${BRANCHNAME}
I'm running through these jobs alot while testing that branch, but as soon as it's merged it's not going to be touched again, which is why i would like to create a job of sorts that simply deletes the jobs that havn't been run for the 14 days or so.
Does anyone know a way of doing this? and not just cleaning out the workspace.
Thanks!
It may be a big change, but this is an ideal case for the Multibranch pipeline.
On one project, we have a master branch and version branches. The developers branch to short-lived feature branches or other branching purposes. As the branches are created and pushed to github, the multibranch job picks them up and starts building them. Developers get quick feedback that the changes will pass the build. When they merge them to master or to a version branch, then delete the branch, the multibranch job goes away.

Run Build after Merging Branch - Team Foundation Server

Is it possible to run an Automated Build when you Merge a Feature Branch into the Development Branch?
When a Developer is done working on their Feature Branch, they will Merge the Feature Branch into the Development Branch. When it is Merge, I would like to fire off an Automated Build, that will run the Unit Tests.
With Continuous Integration, you run the Build when you check in a Changeset. I want to run Continuous Integration when I Merge a Branch into another Branch.
This isn't much different than setting up a build for a normal check in. You would just set up a trigger/build definition on the appropriate branch for the approriate reason. Once the merge is performed into the branch and checked in, this would trigger the build normally.
From my source view see:
KritnerWebsite is trunk, KritnerWebsite-branch is my dev branch.
I complete development/check-ins on the branch, then when done I merge into trunk. At which point the following build definition takes over:
Notice in above the monitored folder for the trigger (in this case gated check in) is my trunk folder in source control.
Hope this helps! :)
FYI a merge isn't actually a "merge" until you check it in and it becomes a changeset. When doing a merge, it actually just gets merged locally - into your workspace. You could technically do a local build at this point, but your build definition won't take over until you actually check it in. I'm not sure why Daniel felt this isn't an answer... as it's the same thing I went through when setting up build definitions for merges - but oh well.

How to sync to a Perforce pending changelist in jenkins

I have a pending changelist that I want to test in the build on our Jenkins server. I tried to do this using a P4 label but syncing to the label does not pick up my pending changelist.
Is there any way to do this with Jenkins SCM configuration?
In general, unless you have some very special circumstances, no other workspace can sync your pending changelist's changes, because they exist ONLY on your own workstation, not on the server. The server knows the names of the files in your pending changelist, but not their contents.
To make your changes accessible to the automated build tools, there are generally two approaches:
You can shelve the changes, then instruct the build tool to build from the shelf, or
You can check your changes into a development branch, then instruct the build tool to build the branch.
Or, of course, you could check your changes into the mainline, and have the build tools build them normally, but I'm guessing from your question you don't want to do that.
You can use the P4 Plugin. Follow the below steps
Create a Jenkins Job
Select checkbox: This project is parameterized
Add parameter name as Changelist
For the first step of build, select the option perforce unshelve and use ${changelist} as Changelist and resolve type as per your requirement
Under Build Trigger, select Trigger builds remotely (e.g., from scripts)
To trigger the build:
Shelve the Changelist
Trigger build with URL http://jenkinurl/projectname/buildWithParam?changelist=< shelved_cl >

Have TeamCity pull a specific ChangeSet from TFS?

I have a CI build in TeamCity that runs on check-in. I have a QA build that is run manually. I would like to specify which ChangeSet the QA build should use so it doesn't inadvertantly push changes that are not ready. Is there a way to tell TeamCity to tell TFS that we want to pull xyz changeset?
Yes, use the "Run ..." button to the right of the build configuration you want to run (ie. click on the ... part).
In that dialog you should be able to pick exactly which changeset TeamCity should use. Note that it seems TeamCity only sees changesets which have occured in TFS after TeamCity started monitoring the repository, so if you want to build against an old changeset you might still be out of luck.

Gated check in for specific branch

I have multiple branches and for every one i have specific build process.
How do i set up gated build process for specific branch?
example
Development branch
-> fast for developers
build process this has main intergation tests
Release branch
-> checkin before production.
contain load testing and records steps contains automated UI tests
Now for my development i want to run tests every time when developer commits changes. but i do not want release build to run every time.
How do i set this up?
You need to have two separate build definitions: One building your 'Development' branch & one building your 'Release' branch.
Both can base on the same Build process template and their differences are:
Dev-build targets in 'Workspace' the path of your development branch - Rel-build targets the path of your release branch
(This is you main question) Trigger = "Gated check-in" for your Dev-build, Trigger = "Manual" (or some other) for your Rel-build
Rel-build will probably be tasked with additional tests.
A basic walkthrough on how to setup a build definition in TFS2010 can be found here

Resources