timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-29068] Split Groovy out of core #7312

Open timja opened 9 years ago

timja commented 9 years ago

Problem Definition

Currently Jenkins embeds a distribution of Groovy into "core" for a variety of scripting and management tasks. This version of Groovy is locked into core in such a way that users cannot upgrade Groovy independently from Jenkins itself. If the Jenkins-bundled version were upgraded to a different major version, it may break users' custom scripts as well as plugins that use Groovy due to API changes.

Proposal

For ease of maintenance and modularity it would be useful to split Jenkins' use of Groovy into a library plugin; different clients could request 1.x and 2.x simultaneously by using different versions of the library, etc.

Stuff in core using Groovy that would need to either be put in this library (if infrastructure for other features) or put in another plugin depending on it (if first-class features themselves):

Impact

The following Jenkins core user features make use of Groovy scripting:

These will need to be moved into a new, bundled plugin, using the currently bundled Groovy version. Existing plugins would get an implied dependency to this 'detached' plugin like the existing mechanism. Using a newer parent POM version and an explicit dependency, they can change which version of Groovy they get on their classpath. This affects plugin internals and any user-level scripting equally, so plugins determine which Groovy version they offer their users.

Other parts are more related to Jenkins internals and would be handled by a module:

Open Questions

Participants

TODO


Originally reported by jglick, imported from: Split Groovy out of core
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 9 years ago

jglick:

May also need to offer version-specific script-security bindings.

timja commented 8 years ago

danielbeck:

Overall/RUN_SCRIPTS looks like something that could be moved into the plugin.

timja commented 8 years ago

jglick:

Do not think so. AdminWhitelistRule.doSubmit checks it. Anyway the concept of the permission is valid independent of any particular scripting language implementation used to access the internal APIs.

timja commented 8 years ago

jglick:

Can we get away with…

If that is the best we can do, why not? Increases download size a little but oh well.

how will this impact script-security plugin?

Potentially the sandbox subsystem needs to be split into a separate plugin per Groovy major release. TBD.

Would they get an implied dependency

Yes that is how plugin splitting works.

How can plugins choose their Groovy version?

Normal plugin dependency mechanism.

What about Groovy views in plugins? Would they get the old 1.x Groovy by default

Yes, just like plugin splitting generally.

Would this tie the plugin-internal Groovy version to the plugin-external Groovy version?

Yes. Should not be a problem that I can see. There is just a task to switch the dep from 1.x to 2.x or 2.x to 3.x and retest.

timja commented 8 years ago

danielbeck:

Yes. Should not be a problem that I can see. There is just a task to switch the dep from 1.x to 2.x or 2.x to 3.x and retest.

Right, so we'd be offloading the Groovy update from core into plugins. There would be no way for users to choose their own "System Groovy" version. This is good to know.

timja commented 8 years ago

danielbeck:

How can plugins choose their Groovy version?

Normal plugin dependency mechanism.

Could you elaborate on that? Would plugins have a dependency on the detached plugin, or the module? How'd they get different versions of Groovy when there's only one plugin?

timja commented 8 years ago

jglick:

Would plugins have a dependency on the detached plugin

Yes.

How'd they get different versions of Groovy when there's only one plugin?

You can create distinct wrapper plugins for each Groovy major release (whatever you think the incompatible change boundary is—probably 1.x to 2.x to 3.x).

timja commented 8 years ago

batmat:

Shouldn't btw this proposal be linked to https://issues.jenkins-ci.org/browse/JENKINS-31035 because having a way to deprecate many things Groovy in core might proove very useful isn't it?

timja commented 8 years ago

martinb3:

As someone who has always found the Groovy subsystem cumbersome, if there's any way you could expose the functionality via plugin, for those of us that would prefer to use other languages or interfaces, I would love to see Groovy moved out of core into a plugin. If the functionality was available via plugin, folks could write other interfaces into other languages or even other protocols like RESTful HTTP. It always drove me crazy that I couldn't map the Groovy API to the classes, methods, and interfaces to the Jenkins CORE API or Jenkins plugins.

timja commented 8 years ago

jglick:

martinb3 whatever you are asking for, I doubt it is blocked by this task, or would be helped by implementing this task.

timja commented 7 years ago

bence_takacs:

Since it is possible to add different 'Groovy installations': what about putting a dropdown to explicitly define the groovy version everywhere you can write script? (and populate it from 'Groovy installations')

When implementing this, do not forget to consider general @Grape support JENKINS-42307

timja commented 7 years ago

danielbeck:

Since it is possible to add different 'Groovy installations':

Groovy plugin functionality has nothing to do with this issue (see 'Impact' section). None of the impacted features launch an external Groovy process.

timja commented 2 years ago

[Originally related to: JENKINS-35514]