1

I am using Jenkins to build a large .NET-based solution tied in to TFS. The first step in the script is to get the latest change sets from TFS, then build the solution. In some other tools I've used, there were options to skip the build if no new changes were found in TFS. Does a similar feature exist in Jenkins? Seems kind of silly to rebuild the entire solution and deploy it if there is nothing new since the last build.

Eric
  • 116
  • 1
  • 3
  • 9
  • Hi Eric, any update on this thread, have you figured it out? If my reply helped or gave a right direction. Appreciate for [marking it as an answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) which will also helps others in the community. – PatrickLu-MSFT May 18 '18 at 03:35

2 Answers2

1

You can use "Poll SCM" option under the Build Triggers section.

Once above option is selected you will be able to set Schedule for polling.

Say for eg. if you set schedule to be @hourly then Jenkins will poll SCM(TFS in this case) every hour and look for changes, if there are any it will build the job else it will not.

In addition to (@yearly, @annually, @monthly, @weekly, @daily, @midnight, and @hourly) Schedule field follows the syntax of cron i.e MINUTE HOUR DOM MONTH DOW

Examples:

every fifteen minutes -> H/15 * * * *

divi
  • 11
  • 4
0

According to your description, the question seems more related to jenkins not TFS side.

Suggest you use the 3-rd party extension-- Conditional BuildStep Plugin. A build step wrapping any number of other build steps, controlling their execution based on a defined condition.

Another way is using two jobs to handle this situation. One to check whether files changed and one to do the actual build. Detail ways please refer below two tutorials:

PatrickLu-MSFT
  • 44,639
  • 4
  • 24
  • 52