a return in a each is like a break in a loop exit from the current context 
with a return value but only one each context, you have two each context 
levels. 

El sábado, 5 de febrero de 2022 a las 18:33:24 UTC+1, Martin Schmude 
escribió:

> In the past I ran into issues with pipeline scripts that did not behave as 
> expected due to CPS transformation.
> See https://www.jenkins.io/doc/book/pipeline/cps-method-mismatches/
>
> https://www.jenkins.io/doc/book/pipeline/pipeline-best-practices/#using-noncps
> Try to annotate interesting_commit_check() with @NonCPS.
>
> [email protected] schrieb am Freitag, 4. Februar 2022 um 21:18:46 UTC+1:
>
>> what's wrong with this code? The output from it was 
>>
>> [Pipeline] echo 
>> <http://jenkins2.eng.riftio.com/view/My%20Builds/job/platform_build/job/master/55/console#>[modules/core/rwvx,
>>  modules/automation/core, modules/tools/scripts, modules/toolchain, 
>> modules/tools/CI, modules/core/util, modules/im/platform][Pipeline] echo 
>> <http://jenkins2.eng.riftio.com/view/My%20Builds/job/platform_build/job/master/55/console#>(modules/core/rwvx|modules/automation/core|modules/tools/scripts|modules/toolchain|modules/tools/CI|modules/core/util|modules/im/platform).*[Pipeline]
>>  echo 
>> <http://jenkins2.eng.riftio.com/view/My%20Builds/job/platform_build/job/master/55/console#>file:
>>  "modules/im/platform"[Pipeline] echo 
>> <http://jenkins2.eng.riftio.com/view/My%20Builds/job/platform_build/job/master/55/console#>interesting
>>  submodule change: modules/im/platform[Pipeline] echo 
>> <http://jenkins2.eng.riftio.com/view/My%20Builds/job/platform_build/job/master/55/console#>no
>>  interesting commits found.
>>
>>
>> which implies that the "return true" was ignored 
>>
>>
>>
>> def interesting_commit_check(topmodule) { 
>>     // returns true if any interesting commits are found
>>     modules=get_dependency_list(topmodule)
>>     modules_re = "(" + modules.join('|') + ").*"
>>     println("${modules_re}")
>>     currentBuild.changeSets.each {
>>         it.items.each {
>>             it.affectedFiles.each {
>>                 pth = it.getPath()
>>                 println("file: \"${pth}\"")
>>                 if (it.getPath().matches('^modules.*')) {
>>                     // in a submodule ... is it an important one?
>>                     if (pth.matches(modules_re)) {
>>                         print("interesting submodule change: ${pth}")
>>                         return true
>>                     } else {
>>                         print("ignoring submodule change in ${pth}")     
>>                                                                             
>>              
>>                     }
>>                 } else {
>>                     if ( pth == "RELEASE" ) {
>>                         println("ignoring release change")
>>                     } else {
>>                         print("ignoring supermod change: ${pth}")
>>                     }
>>                 }
>>             }
>>         }
>>     }
>>     print("no interesting commits found.")
>>     return false
>> }
>>
>> *Jeremy Mordkoff*
>> Director, Engineering Services
>> <https://dzsi.com>
>>
>> *Headquarters: 5700 Tennyson Parkway, Plano, Texas, USA *
>> *Mobile*: +1 978.257.2183 <(978)%20257-2183>
>> *Email: *[email protected]
>>
>> <https://dzsi.com>
>>
>> <https://www.linkedin.com/company/dzsi/> 
>> <https://twitter.com/dzs_innovation> 
>> <https://www.youtube.com/channel/UCgr0fSzluyi0QYaoDgHhkBg>
>>
>>
>> *Disclaimer*
>>
>> The information contained in this communication from the sender is 
>> confidential. It is intended solely for use by the recipient and others 
>> authorized to receive it. If you are not the recipient, you are hereby 
>> notified that any disclosure, copying, distribution or taking action in 
>> relation of the contents of this information is strictly prohibited and may 
>> be unlawful.
>>
>>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/032587b3-daf2-4e56-9ea8-be2835d63375n%40googlegroups.com.

Reply via email to