Ah, could be - anyone else can shed some light on whether using 'sh' in expression {} in declarative pipeline is fully supported or just happens to work sometimes?
pipeline { [...] stages { stage('Maven build') { when { expression { triggeredByBranchIndexing = currentBuild.rawBuild.getCause(jenkins.branch.BranchIndexingCause) != null grepExitStatus = sh(script: 'git log -1 | grep maven-release-plugin', returnStatus: true) return !triggeredByBranchIndexing || grepExitStatus == 1 // grep exit status is 0 if a line is selected } } [...] } } } On Tue, Jan 16, 2018 at 12:55 AM, Daniel Beck <m...@beckweb.net> wrote: > > > On 15. Jan 2018, at 23:05, ST <st.mailingli...@gmail.com> wrote: > > > > Any input appreciated! > > > > Not sure but maybe pipeline steps like 'sh' aren't supposed to be used in > when expression blocks? > > -- > 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/F3101214-5ACA-4833-B28C-2B1D67755C59%40beckweb.net. > 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/CABwQARvMGrD6OkPJ7UkzF1%3DKk4RXGxKVT9h4yPPR%3Da009G1V%3Dg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.