Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up[JENKINS-34002] introduce requirePlugins step #31
Conversation
|
Really a great idea! I love it |
| private final String plugins; | ||
|
|
||
| @DataBoundConstructor | ||
| public RequirePluginsStep(String plugins) { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
batmat
Jan 14, 2017
•
Author
Member
I don't feel that strongly, so will do as you prefer, but I chose that on purpose. It just felt to me a wee bit more cumbersome to type "square bracket quote plugin name quote comma quote plugin name quote square bracket" than "quote plugins I need separated by comma/space quote" :-)
This comment has been minimized.
This comment has been minimized.
batmat
Jan 15, 2017
Author
Member
BTW, trying to find an example of how to handle arrays/list for the Snippet Generator, any pointer? Thanks
This comment has been minimized.
This comment has been minimized.
batmat
Jan 15, 2017
Author
Member
OK, found it. So basically we use a textfield and process the provided content from string to array.
https://github.com/batmat/workflow-basic-steps-plugin/blob/300fe6c02b41f072e50a501cfec3e2f425048446/src/main/resources/org/jenkinsci/plugins/workflow/steps/EnvStep/config.groovy#L4
This comment has been minimized.
This comment has been minimized.
svanoort
Jan 15, 2017
Member
@jglick I think you may have two stories confuse here - I'm not working on the dependencies bit, but the StepAction, so if Batmat is doing something that replaces it, 100% thrilled here :)
This comment has been minimized.
This comment has been minimized.
HRMPW
Jan 15, 2017
JENKINS-31582 is assigned to you @svanoort but I don't think it is in-progress. AFAIK, what @batmat is doing here only allows the users to manually define what plugins need to be available. This would make Jenkinsfiles more portable but it is still manual and doesn't replace JENKINS-31582. When we get to JENKINS-31582 we can make it works with this.
| version = versioned[1]; | ||
| } | ||
|
|
||
| final Plugin plugin = Jenkins.getActiveInstance().getPlugin(pluginId); |
This comment has been minimized.
This comment has been minimized.
jglick
Jan 14, 2017
Member
I do not think this is the class you want to use. IIRC PluginManager has a better way of getting the PluginWrapper directly. Also you need to check for activation status.
This comment has been minimized.
This comment has been minimized.
batmat
Jan 14, 2017
Author
Member
Oh right for the activationstatus. Indeed, if the plugin is disabled, then it won't fail right now which would be quite surprising for the user. Will look into PluginManager usage too. Probably tomorrow or so.
HRMPW
commented
Jan 15, 2017
|
@batmat do you mean both or just this or #33? Does putting it in syntax checking buy us much, @abayer ? This syntax is dependent on the Jenkins it is running on so valid syntax one Jenkins will fail on a different Jenkins. If I validate my Jenkinsfile on a Jenkins and then try to run it on another it's going to fail at runtime regardless of the syntax. We essentially save the compilation time but the Pipeline would fail quickly anyway. For Declarative Syntax something like this might work well:
|
|
@HRMPW I mean: maybe
|
HRMPW
commented
Jan 16, 2017
|
Honestly, with Declarative we already have explicitly Granted this might not account for |
|
Actually, that wouldn't work with Declarative - if a step class isn't installed, I can't tell that something like |
HRMPW
commented
Jan 16, 2017
|
Then the inverse would cause confusion, too. Now, we would require end users to know what is a step and what is a global library. If a user sees all of the steps that are used in his/her pipeline and adds them to the |
|
For my part, I would say Getting too fine-grained will just be annoying. The point of this is (in my mind) is to say, "This Pipeline requires these components", not to say "This Pipeline requires these parts of these components." When would a user install only part of a plugin? |
Because IMO most users don't know and probably don't care where steps are coming from. And we're not talking about installing only a part of plugin, but using. As a user I know which steps I want and use: like It's probably harder to find out, and I care less about the plugins those steps are in (and considering they won't move from one plugin to another), which in that case the equivalent would be: requirePlugins ["pipeline-utility-steps","workflow-durable-task-step","pipeline-input-step"] |
|
@batmat - Ah, I see. I guess, it depends on the user. I don't know, listing all the steps still seems excessive. At the top, you described this as a "proposal" to address JENKINS-34002. But this and #33 don't really address that issue in a cohesive way. Part of why we'd want this functionality is to improve the clarity and stability of Pipeline code. That means that providing more ways to do this is not necessarily better. I don't mean to dump on what you've done. It is great to see this getting attention, but just implementing and releasing several ways to do this does improve things. The range of this thread and the question being asked are good examples of that. It seems to me like more design and discussion is needed before we start talking about pull requests for specific implementations. What do you think of the ideas in JENKINS-34002? @jglick @svanoort - You're working on something in the Pipeline Syntax area related to this? Is there an issue tracking that? Is that linked to JENKINS-34002 or separate? @abayer @HRMPW - Is some form of this "requires" structure part the plan for Declarative? Part of the launch? There's already a |
|
|
Once again @jglick I'm unclear how my work on jenkinsci/workflow-api-plugin#26 relates to this? |
Because it is very unfriendly to expect users to know exactly which plugins their build used. Sometimes it is obvious, sometimes not. With that API in hand, the Snippet Generator can offer you an initial list of plugin names and versions which the last successful build of the project actually used, at least in step configuration, so you do not have to spend time researching that. |
HRMPW
commented
Feb 28, 2017
|
@bitwiseman Apologies neither @abayer nor I responded on this before. A couple of things come to mind here:
|
|
I pretty much always want a Scripted step to build Declarative sugar on top of, so yeah. |
|
@jglick For the 3rd time: that workflow-api work does not add tracking of plugin & version. It tracks arguments supplied to the |
|
@HRMPW and all, so how do you feel about this one? We can close it if there's no plan to merge it. No problem, I learnt a bit about pipeline steps development in the go, so not a total loss for me anyway :-). Just let me know. |
HRMPW
commented
Mar 30, 2017
|
@batmat I think there is value here. It might be somewhat manual to use right now but we can still implement this step and add some automation and plugin discovery on it later. |
But you should be able to reconstruct plugin information from that, no? If not, we will need to amend that API. This is critical for usability of a |
HRMPW
commented
May 23, 2017
|
Is JENKINS-31582 really required here? I'm not opposed to getting JENKINS-31582 done, too, especially if it were integrated with requirePlugins in Snippet Generator. However, it seems like an initial version of this could be done without having an automated list generated. Otherwise, we leave @batmat hanging here until the rest is complete. |
|
Pretty awkward without that—you would need to go to |
|
|
|
Closing it for clarity it's mostly inactive and needs fixes unfortunately I have currently no time to work on. It's linked from the JIRA issue though, so anyone wanting to take over is obviously and warmly welcome. |
batmat commentedJan 14, 2017
•
edited
I started looking into this before finally finding JENKINS-34002.
Initially, I thought I would contribute this into
pipeline-utility-steps, but then I thought this is really a core step IMO: because having to make sure some non compulsory plugin is installed, to check for some other plugins presence would somehow be defeating the purpose.Being able to simply express some plugins requirements, and fail fast if absent, as the first instruction of a pipeline would provide great value (compared to the low complexity of this code).
Usage: