Re: Pipeline when condition issue

2018-08-29 Thread Michael Fowler
Thanks Devin, that worked!

On Wed, Aug 29, 2018 at 11:44 AM Devin Nusbaum 
wrote:

> I think the problem is with your regex match. Based on
> http://mrhaki.blogspot.com/2009/09/groovy-goodness-matchers-for-regular.html,
> it looks like the operator to use is `==~`, but you have `== ~` with a
> space.
>
> The stage is skipped correctly if I use `Development ==~
> /(?i)(1|Y|YES|T|TRUE|ON|RUN)/` (remove the space before the ~).
>
> On Aug 28, 2018, at 21:49, MDKF  wrote:
>
> Hi All,
>  I have the following pipeline. I don't expect the steps in the when
> condition to run, but they are. Can anyone tell me what i'm doing wrong? (I
> know using an expression instead of a simple equals is overkill, but this
> is a simplified example to show my issue)
> -Michael
>
> pipeline {
>
>  // Discarded: Promote Builds When...
>
>  agent any
>  environment {
> Development = true
> }
>  stages {
> stage('test') {
> when {
> not {
> expression {
> Development == ~/(?i)(1|Y|YES|T|TRUE|ON|RUN)/
> }
> }
>}
>steps {
>echo 'Development is false'
> }
>  }
>  }
> }
>
> --
> 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/f76ece7d-c962-4914-bdbd-c8addfb58ea9%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/jenkinsci-users/r2V5nHoKe04/unsubscribe.
> To unsubscribe from this group and all its topics, 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/4C2474BB-A780-458B-9EBD-DFCB5C29F9BB%40cloudbees.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CADj6zs7_MkYXJZeAjn3bMik9JRtKiGb8xUH7JHo1Sn3H5bysAA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pipeline when condition issue

2018-08-29 Thread Devin Nusbaum
I think the problem is with your regex match. Based on 
http://mrhaki.blogspot.com/2009/09/groovy-goodness-matchers-for-regular.html 
, 
it looks like the operator to use is `==~`, but you have `== ~` with a space.

The stage is skipped correctly if I use `Development ==~ 
/(?i)(1|Y|YES|T|TRUE|ON|RUN)/` (remove the space before the ~).

> On Aug 28, 2018, at 21:49, MDKF  wrote:
> 
> Hi All,
>  I have the following pipeline. I don't expect the steps in the when 
> condition to run, but they are. Can anyone tell me what i'm doing wrong? (I 
> know using an expression instead of a simple equals is overkill, but this is 
> a simplified example to show my issue)
> -Michael
> 
> pipeline {
> 
>  // Discarded: Promote Builds When...
> 
>  agent any
>  environment {
>   Development = true
>   }
>  stages {
> stage('test') {
> when {
> not {
> expression {
> Development == ~/(?i)(1|Y|YES|T|TRUE|ON|RUN)/
> }
> }
>}
>steps {
>echo 'Development is false'
> }
>  }
>  }
> }
> 
> -- 
> 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/f76ece7d-c962-4914-bdbd-c8addfb58ea9%40googlegroups.com
>  
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
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/4C2474BB-A780-458B-9EBD-DFCB5C29F9BB%40cloudbees.com.
For more options, visit https://groups.google.com/d/optout.


Pipeline when condition issue

2018-08-28 Thread MDKF
Hi All,
 I have the following pipeline. I don't expect the steps in the when 
condition to run, but they are. Can anyone tell me what i'm doing wrong? (I 
know using an expression instead of a simple equals is overkill, but this 
is a simplified example to show my issue)
-Michael

pipeline {

 // Discarded: Promote Builds When...

 agent any
 environment {
Development = true
}
 stages {
stage('test') {
when {
not {
expression {
Development == ~/(?i)(1|Y|YES|T|TRUE|ON|RUN)/
}
}
   }
   steps {
   echo 'Development is false'
}
 }
 }
}

-- 
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/f76ece7d-c962-4914-bdbd-c8addfb58ea9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.