0

I am polling Accurev SCM after every 30 minutes using Poll SCM as H/30 * * * *

However, I want to change the functionality so that Accurev is polled by Jenkins only after there are changes in code in Accurev. I don't want to keep polling Accurev SCM after every 30 minutes

Please let me know how that can be achieved.

meallhour
  • 13,921
  • 21
  • 60
  • 117
  • You do realize that the SCM polling is how Jenkins knows your repository changed? You're effectively asking if there is a way to only check if a change happened once you know for sure that a change has occurred. If you could do this why poll at all, just start the job. – Tuffwer Mar 03 '16 at 21:22
  • Actually, I want to start the job everytime a change occurs. – meallhour Mar 03 '16 at 21:40
  • Are you using this plugin [AccuRev Plugin](https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=3309595)? If so the simple answer would be to poll with a much much shorter frequency than you are. After some quick reading on that plugin I don't think that functionality exists currently. It hasn't been updated since 2014. You might be able to fork it on Git and write your own method that allows a trigger on SCM change. That would probably involve setting up something that pushes a notification to the plugin though. – Tuffwer Mar 03 '16 at 22:02
  • Yes, I am using AccuRev plugin. Can you throw some light on how `to fork it on Git and write your own method that allows a trigger on SCM change. That would probably involve setting up something that pushes a notification to the plugin though` – meallhour Mar 03 '16 at 22:06
  • Not much really, I'm not particularly familiar with Java (you'd need to write some code to do this) and this could be a terrible approach, but: Here is the [git repo](https://github.com/jenkinsci/accurev-plugin) You'll want to do a pull request to get the source code of the plugin and then add a method that listens (perhaps with TCP/IP?) for some sort of notification and starts the job. You'll then have to see if the AccuRev repo can send a notification. If it can you'll want to figure out it's structure and write your method in the plugin to parse that notification correctly. 1/2 – Tuffwer Mar 03 '16 at 22:12
  • It would take much more time (and knowledge, given my lack of Java experience) than I can spare to actually do this but that's a high level description of what would need to be done. – Tuffwer Mar 03 '16 at 22:13

1 Answers1

2

You can use AccuRev triggers to call the build of your Jenkins job. If you set a server-side trigger, like server-post-promote-trig (documentation), AccuRev will execute a task every time a change is promoted to a certain stream.

The only thing you need to code in that trigger will be a call to http://your_jenkins_server/job/your_job/build and Jenkins will execute the job immediately, so you don't need to select any checkbox under the "Build Triggers" section.

Johnbo
  • 498
  • 6
  • 16