Tried to remove triggers { pollSCM('H/5 * * * *')  } and use checkout 
function as you describe, but then it is not triggered if there are changes 
in the branch.

Am Dienstag, 5. Mai 2020 17:11:13 UTC+2 schrieb Aryo Kusumo:
>
> Maybe you could try this. It's works for me.
>
> checkout([$class: 'GitSCM', branches: [[name: '$branch_name']], extensions: 
> [[$class: 'WipeWorkspace'], url: '$git_url']]])
>
>
> On Tue, 5 May 2020, 20:15 Den, <denni...@gmail.com <javascript:>> wrote:
>
>> Hello,
>>
>> I have a pipeline which should only build if there are changes in branch 
>> specified. It builds however every 5 minutes, since there are changes in 
>> master. Is there a way to poll scm only for a branch?
>>
>> Den
>>
>> pipeline {
>>     agent none
>>     triggers {
>>         pollSCM('H/5 * * * *')
>>     }
>>     stages {
>>         stage ('SCM Pull') {
>>             agent any
>>             steps {
>>                 git branch: "mybranch", url: "$URL"
>>             }
>>         }
>>     ...
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkins...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/74e2a3e0-75c3-46bd-b6ed-d1d461398774%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/74e2a3e0-75c3-46bd-b6ed-d1d461398774%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b74b5db4-371b-4448-96ad-bb2f1b5204d7%40googlegroups.com.

Reply via email to