Hello!

Pipeline jobs allow setting up very powerful jobs for the different 
projects in our group, however a major disadvantage is that it does not 
support building the script portion of the job using an API, and instead it 
requires injecting an entire script as a string. This requires all users to 
know the declarative pipeline syntax and does not allow sharing common 
functions and practices.

To solve this issue, we've developed in our team a tool that allows you 
building the script portion of the pipeline job using simple groovy syntax.
For example,
String script = PipelineScript.create()

.setAgent(...)
.addStage(checkoutFromGit(...))
.addStage(Stage.create('Static Code Analysis')

.addStep(sh('./gradlew condenarcMain'))
.addPost(Post.Condition.Always, publishHtml(...)))

.addPost(Post.Condition.FAILURE, deleteDir())



- This system allows using helper methods as shown in the example to 
simplify the usage for most users.
- Support for using pre-configured stages as well as creating your own.
- Support for parallel stages, conditions along with most of the features 
already supported in the declarative syntax.
- Extends DSL API

The current way we use this script variable is as follows:
new PipelineJobBuilder(this as DslFactory, projectName)

.build(script)


I'd like to wrap this library as an app to provide this API for other 
people to use.
Let me know what you think!

Thanks,
Sharon

-- 
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/5c61efc8-72ba-41f9-a9be-5ffe281da515%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to