Keep an eye on JENKINS-35390 
<https://issues.jenkins-ci.org/browse/JENKINS-35390>.

Though the other day I optimistically tried to use Groovy's AST transform 
@Immutable 
<http://docs.groovy-lang.org/latest/html/gapi/groovy/transform/Immutable.html> 
on a class ... should've known that would not play nicely with the CPS 
transforms.

On Friday, October 14, 2016 at 8:33:49 AM UTC-7, Jonathan Hodgson wrote:
>
>
>
> On Friday, October 14, 2016 at 1:47:24 PM UTC+1, Daniel Beck wrote:
>>
>>
>> > On 14.10.2016, at 13:25, Jonathan Hodgson <[email protected]> wrote: 
>> > 
>> > All I've done is move that one line, and for the record at the moment 
>> it's being called without OSX being active, so nothing inside that first if 
>> statement is being executed (though it shouldn't cause any problems even if 
>> its was) 
>> > 
>> > I'm confused, and frustrated. Any help greatly appreciated. 
>>
>> The last statement in a Groovy method is the implicit return value. 
>> `find` returns a LinkedHashMap$Entry, it gets returned from the method 
>> call, and it breaks due to CPS serialization. 
>>
>> Thanks Daniel, I'm still finding my feet with Groovy, throw in the CPS 
> issues plus other pipeline job problems (e.g. the lack of working file 
> parameters) and I find myself going round and round until I don't know 
> which way is up, down or sideways.
>
> Changing things to
>
> @NonCPS def isPlatformActive(platform, active_builds)
> {
>     found = (null != active_builds[platform].find { it.value == true } )
>     found
> }
>
> Seems to have fixed this issue
>
>
>> Regarding the regression, likely due to 
>> https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Groovy+Plugin#PipelineGroovyPlugin-2.14%28Sep07%2C2016%29
>>  
>>
>>
> Thanks again.
>
> It's the lack of consistency which is driving me nuts, things work in one 
> place, but not another, or they work with one version, but not the next. It 
> makes debugging so hard. 
>
> And for the love of God could somebody please implement some useful error 
> messages!?
>
> Things should either work, or not work with a suitable error message.
>
> I don't know how difficult it would be, but a lint style checker that 
> would pick up forbidden constructs in CPS functions would be nice too... 
> but there I'm getting into dreamland I fear.
>

-- 
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/02e75241-3f24-4e97-b446-aa145870995a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to