Jenkins Plugin vs Pipeline Shared Libraries

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Jenkins Plugin vs Pipeline Shared Libraries

Michael Carter
Did my release of my new Jenkins Plugin on Wed and everything has been going as plan, at least from a technology standpoint, thanks for all the help... but we have a new employee that was hired recently who is suggesting, day of the release ironically, we scrap the newly developed plugin in favour of Pipeline Shared Libraries.   I'm trying to verify some of the claims and rather than trying to find documents, which may not exist, figured I just save time ask the experts. 

The link I was provided to this next-generation tool to replace Jenkins Plugins interface (or at least that's the comment made in the meeting). https://www.jenkins.io/doc/book/pipeline/shared-libraries/

Mainly just need a Yes/No on these so I can keep or stop looking for how-to docs.

Claims:
  • can pipeline shared libraries create UI interfaces so that rather than writing pipeline code our developers can just add UI selections to the pipeline job like Jenkins Plugin can for FreeStyle jobs?
  • can pipeline shared libraries include and access third-party Java SDKs jars?   Similar to docker SDKs or cloud SDKs for example?   Not using existing plugins but on top of these SDKs directly... SDK I'm using I can't share here, they're in house and I'm under an NDA, and no existing jenkins plugin exists.   So sorry to be a bit vague.
  • Can pipeline shared libraries create new credentials types or new credential store providers, I'm dealing with an external password manager which I'm sync'ing up with jenkins?
  • Can shared libraries be run as background sync/bridge that runs as a task over running as a job/build?   When I'm dealing with security scanners and such I went the direction of a plugin so it couldn't easily be tampered with.... but supposedly we can do this with shared libraries as well?
  • Can shared libraries add items/jelly files to snippet generator area?   My understanding was you needed to include some @Library command but it's been suggested the snippet generator will build all that code for you so adding is just a cut/paste away.
  • Can shared libraries add global variables read from REST APIs to be available to FreeStyle jobs?   We have some freestyle jobs that would need to make use of this Shared Library code.?   I know global variables are accessible to pipeline but what about non-pipeline jobs/code?
  • Can shared libraries hook into pre/post job hooks? (like publisher, notifier, triggers)   We have code, which developers often remove, that need to be run pre/post jobs.  Plugin offers me that option.  Trying to figure out where the shared libraries offer it.  (again especially in FreeStyle jobs)
The main line I hear, in multiple versions mainly by our report developers, is "it's unreasonable for me to expect developers to understand how to write scripts/pipeline code".   (not that it was my decision to make them do anything ;) ... and I can't blame them... if you've been hired to develop reports in a UI reporting tool why do you need to learn pipeline/java/groovy to move your report CICD system)

So the point with this plugin was to offer a turn-key solution or at the very least a "dropdown driven" option via the Snippet Generator, for them to cut and paste from.   So if this pipeline shared libraries can reach this and other goals I'll concede to the new direction.   When I initially investigated shared libraries it had gaps to what I needed, so mostly posting this to verify I'm not losing my mind :P

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/de1ccee1-2b55-449a-9c6a-c47bdb498f37o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins Plugin vs Pipeline Shared Libraries

Tim Jacomb
You probably already know the answer but no a pipeline library can’t do most of that...

It can run external code in libraries, via @grab (not really recommended) or by installing the library on the agent and calling it via shell scripts

Shared libraries can’t be used for freestyle jobs at all as far as I know

Thanks
Tim

On Sat, 18 Jul 2020 at 16:41, Michael Carter <[hidden email]> wrote:
Did my release of my new Jenkins Plugin on Wed and everything has been going as plan, at least from a technology standpoint, thanks for all the help... but we have a new employee that was hired recently who is suggesting, day of the release ironically, we scrap the newly developed plugin in favour of Pipeline Shared Libraries.   I'm trying to verify some of the claims and rather than trying to find documents, which may not exist, figured I just save time ask the experts. 

The link I was provided to this next-generation tool to replace Jenkins Plugins interface (or at least that's the comment made in the meeting). https://www.jenkins.io/doc/book/pipeline/shared-libraries/

Mainly just need a Yes/No on these so I can keep or stop looking for how-to docs.

Claims:
  • can pipeline shared libraries create UI interfaces so that rather than writing pipeline code our developers can just add UI selections to the pipeline job like Jenkins Plugin can for FreeStyle jobs?
  • can pipeline shared libraries include and access third-party Java SDKs jars?   Similar to docker SDKs or cloud SDKs for example?   Not using existing plugins but on top of these SDKs directly... SDK I'm using I can't share here, they're in house and I'm under an NDA, and no existing jenkins plugin exists.   So sorry to be a bit vague.
  • Can pipeline shared libraries create new credentials types or new credential store providers, I'm dealing with an external password manager which I'm sync'ing up with jenkins?
  • Can shared libraries be run as background sync/bridge that runs as a task over running as a job/build?   When I'm dealing with security scanners and such I went the direction of a plugin so it couldn't easily be tampered with.... but supposedly we can do this with shared libraries as well?
  • Can shared libraries add items/jelly files to snippet generator area?   My understanding was you needed to include some @Library command but it's been suggested the snippet generator will build all that code for you so adding is just a cut/paste away.
  • Can shared libraries add global variables read from REST APIs to be available to FreeStyle jobs?   We have some freestyle jobs that would need to make use of this Shared Library code.?   I know global variables are accessible to pipeline but what about non-pipeline jobs/code?
  • Can shared libraries hook into pre/post job hooks? (like publisher, notifier, triggers)   We have code, which developers often remove, that need to be run pre/post jobs.  Plugin offers me that option.  Trying to figure out where the shared libraries offer it.  (again especially in FreeStyle jobs)
The main line I hear, in multiple versions mainly by our report developers, is "it's unreasonable for me to expect developers to understand how to write scripts/pipeline code".   (not that it was my decision to make them do anything ;) ... and I can't blame them... if you've been hired to develop reports in a UI reporting tool why do you need to learn pipeline/java/groovy to move your report CICD system)

So the point with this plugin was to offer a turn-key solution or at the very least a "dropdown driven" option via the Snippet Generator, for them to cut and paste from.   So if this pipeline shared libraries can reach this and other goals I'll concede to the new direction.   When I initially investigated shared libraries it had gaps to what I needed, so mostly posting this to verify I'm not losing my mind :P

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/de1ccee1-2b55-449a-9c6a-c47bdb498f37o%40googlegroups.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAH-3Bierg4ksxehornuVeeT6VBj7xK5Y7FrAs6kRO3mQsyRs1g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins Plugin vs Pipeline Shared Libraries

Jesse Glick-4
In reply to this post by Michael Carter
On Sat, Jul 18, 2020 at 11:41 AM Michael Carter
<[hidden email]> wrote:
> can pipeline shared libraries create UI interfaces so that rather than writing pipeline code our developers can just add UI selections to the pipeline job like Jenkins Plugin can for FreeStyle jobs?

No, there is no integration with the *Pipeline Syntax* pages. In
principle there could be some system by which a library could include
metadata (Groovy annotations?) that could be introspected and generate
a RAD-builder-like GUI, but there has been no such effort.

> can pipeline shared libraries include and access third-party Java SDKs jars?   Similar to docker SDKs or cloud SDKs for example?   Not using existing plugins but on top of these SDKs directly

They _can_, via `@Grab`, but it is not recommended. (See
https://github.com/jenkins-infra/jenkins.io/pull/3535 for docs.) In
most cases you can get a similar effect from a library by bundling
(via `libraryResource`) or otherwise referring to external (`sh` etc.)
tools that run like any other build steps in a workspace.

> Can pipeline shared libraries create new credentials types or new credential store providers, I'm dealing with an external password manager which I'm sync'ing up with jenkins?

No, this must be done via a plugin:
https://www.jenkins.io/doc/developer/extensions/credentials/#credentialsprovider

> Can shared libraries be run as background sync/bridge that runs as a task over running as a job/build?

No, code runs the same way as any other Pipeline script, within the
context of a build.

> Can shared libraries add items/jelly files to snippet generator area?

See above.

> Can shared libraries add global variables read from REST APIs to be available to FreeStyle jobs?

No, libraries are very specific to Pipeline.

> Can shared libraries hook into pre/post job hooks? (like publisher, notifier, triggers)

Publishers and notifiers exist only for traditional job types.
Pipeline jobs have undifferentiated “steps” which can be run at any
time.

Triggers must be implemented in plugins:
https://www.jenkins.io/doc/developer/extensions/jenkins-core/#trigger

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0xTtmLm9K0WVyno_xd317aPfOR74mCSBcMsjBb2cFzDQ%40mail.gmail.com.