On Fri, May 27, 2016 at 3:12 AM, Stephen Connolly < stephen.alan.conno...@gmail.com> wrote:
> > > On 27 May 2016 at 07:59, Craig Rodrigues <rodr...@freebsd.org> wrote: > >> >> Here are some of the pain points I've encountered with Pipeline scripts: >> >> - Other than the most trivial of scripts, you need to be a >> knowledgable Groovy programmer. For example, to make a global variable, >> you need to use a @Field. (What?!) Most scripting and devops people that >> I know don't really know Groovy. >> >> So in my personal opinion, this is a sign of People Doing Things Wrong™ > > By this I mean that your Jenkinsfile should *not* be doing complex things. > You should have shell scripts or equivalent to do the complex > functionality. That lets you test each individual step in the phase on > local developer machines. Then your pipeline should end up mostly being > > I have written Jenkinsfiles as you describe where the Jenkinsfile is "simple", and it calls external scripts written in other languages (Bourne shell, Python, etc.). However, even with Jenkinsfiles that are not doing complex things, things can get very confusing very quickly. Multiple people have asked about global variables in Jenkins scripts, and get really confused when they read that using @Field will eliminate syntax errors. Here are a few threads on this topic: https://groups.google.com/d/msg/jenkinsci-users/P7VMQQuMdsY/bHfBDSn9GgAJ https://groups.google.com/d/msg/jenkinsci-users/rQe45k6Uu3E/_7l3eZHIAwAJ There have been a few questions on the mailing list about how to refactor Jenkinsfiles into common files that can be included: https://groups.google.com/d/msg/jenkinsci-users/cmFUKUW4cWI/X6vHGK15AwAJ Personally, I've found this to be unintuitive, and the recommended strategy of using workflow-cps-global-lib is very weird and uintuitive. You may disagree with me, but my experience is though Pipeline is a nice DSL, as a script writer, you can't hide the fact that Jenkinsfiles are Groovy code. Having a good understanding of Groovy and how the Groovy Pipeline code integrates with Jenkins core is critical for being successful with Pipeline (maybe this will become less necessary as Pipeline matures and stabilizes). Not all devops people who work with Jenkins are Java/Groovy hackers, so this can be a bit problematic, in terms of scaling and maintaining complicated workflows based on Jenkinsfiles. -- Craig -- 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/CAG%3DrPVcdHLT_SoitLZ%2B%3D-3eiT2zY8UiJb0%2BrtNs%3D2hpU3%2BoyFQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.