> Yes declarative has both of these in a way via the when directive's branch
 and changeset conditions. If I've interpreted forBranch and forChangesIn
correctly :)

Thanks Robert, this is exactly it (we are using scripted pipelines for
their flexibility, I was not aware of this syntax in the declarative ones)

So what about bringing the functionality of "when(changeset ...)" over to
the scripted pipelines? (maybe as proposed as forChangesIn(), but I see
some people didn't understand it, so maybe whenChangesIn() or similar is
better, other suggestions?). One thing I'd like to see though is to have
the ability to specify RegEx over ant glob patterns - RegEx is as simple as
the glob patterns for simple cases, but can cover any complicated cases as
well (where the glob patterns are quickly limited)

Regarding forBranch()
> You would just use `if` statements and the like.
Exactly, you can.
My Point was though that it would be nice to have the syntax [2] because
syntax [1] is not as readable.

[1]

... build (that is usually the same for all branches)....

if (env.BRANCH_NAME.startsWith("feature/") ||
env.BRANCH_NAME.startsWith("bugfix/")) {
      // enforcers validation only necessary on new code before merging
}


if (env.BRANCH_NAME.startsWith("develop") ||
env.BRANCH_NAME.startsWith("feature/")) {
      // integration test not on bug fix branches
}

if (env.BRANCH_NAME.startsWith("develop")) {
     // deployment to a dev environment, automatic
}

if (env.BRANCH_NAME.startsWith("develop") ||
env.BRANCH_NAME.startsWith("release")) {
      // deploy to a validation environment used by CQ (manual trigger,
they chose which branch they use)
}

[2]

... build (that is usually the same for all branches)....

forBranch("(feature|bugfix)/.*") {
   // enforcers validation only necessary on new code before merging
}
}
forBranch("develop|feature/.*") {
   // integration test not on bug fix branches
}
forBranch("develop") {
     // deployment to a dev environment, automatic
}
forBranch("develop|release/.*") {
    // deploy to a validation environment used by CQ (manual trigger, they
chose which branch they use)
}


On Fri, Apr 13, 2018 at 3:39 PM, Jesse Glick <jgl...@cloudbees.com> wrote:

> On Fri, Apr 13, 2018 at 1:14 AM, <thorsten.hoe...@taimos.de> wrote:
> > Is "when" also possible in scripted pipelines?
>
> You would just use `if` statements and the like.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Jenkins Developers" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/jenkinsci-dev/mDLg7W6Xq68/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> jenkinsci-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-dev/CANfRfr051Mhd8PtLfdbDzq5GFZbGF
> MgqwVQFAZ4CCrh88%3D%3D6tA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Georg Henzler
Principal Solution Architect
georg.henz...@netcentric.biz
M: +49 171 92 46 474

*Netcentric, A Cognizant Digital Business** | www.netcentric.biz
<http://www.netcentric.biz>*
Follow us on LinkedIn | Twitter
<https://twitter.com/netcentrichq>Other disclosures according to § 35a
GmbHG, § 161, 125a HGB: www.netcentric.biz/imprint.html

This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient(s), please reply to the
sender and destroy all copies of the original message. Any unauthorized
review, use, disclosure, dissemination, forwarding, printing or copying of
this email, and/or any action taken in reliance on the contents of this
e-mail is strictly prohibited and may be unlawful.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CALkeWMexqE7Eyok9ckmjzEEs_nb_M5ao4eM5nuxTpftxdyEeqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to