Hi all, 

we've been using the Jenkins pipelines pretty much from the day when they 
were released. As we use a fairly standardised build process across all 
projects in our organisation, we use shared libraries heavily to avoid 
redundancy across the repositories' Jenkinsfiles. For two little 
functionalities, I would propose to promote them to "official build steps" 
written in Java and hence available to the broader Jenkins community:

forBranch("feature/.*") {
    // only executed if on feature branch (if regex matches)
}

forChangesIn(".*/apache-config/.*") {
   // somehow apply apache config, but only if it has changed
}

The implementation of forBranch() is fairly trivial, it only checks for 
env.BRANCH_NAME and matches against the given regex. forChangesIn() is a 
bit more complicated (iterating over all changesets of all SCMs), but also 
fairly straight-forward. 

forBranch() would help making Jenkinsfiles better readable and concise 
(obviously the same can be done with an if, but comparing the two versions 
shows clearly that the if-variant introduces a more boilerplate).

forChangesIn() is a functionality that I believe is not readily available 
yet (correct me if I'm wrong!)

The two steps could be put directly in workflow-basic-steps-plugin or maybe 
in pipeline-utility-steps-plugin. forBranch() potentially would be better 
suited for workflow-multibranch-plugin. 

WDYT?

-Georg

-- 
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/17cc4fc7-5603-4fe3-b721-73306ab0b363%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to