Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54441

Display class and plugin for workflow steps

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: workflow-cps-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 2.138.2, org.jenkins-ci.plugins.workflow:workflow-cps:2.60
    • Similar Issues:

      Description

      The "/pipeline-syntax/ ("Pipeline Syntax Snippet Generator") view exposed by workflow-cps-plugin, and the related "/pipeline-syntax/html" ("Steps Reference") don't expose any information about where a step comes from - the plugin, class, etc.

      This makes it awfully hard to track things down when trying to debug an issue.

      It'd be a big improvement if steps were annotated  in the help with their implementing class in both places. So in the snippet generator when you choose a "Sample Step" it loads the step descriptor and shows:

      • Step description if any
      • Implementing class
      • "Friendly name" of plugin containing implementing class and its actual plugin-id too, with a link to the plugins wiki

      I've spent way too long trying to find a step's implementation in a sub-sub-sub plugin of a plugin, which has two different display names, a different internal plugin name, and a different-again git repo name.

      For the bigger picture of "how do I identify where X came from in Jenkins" see JENKINS-26565.

      See also JENKINS-54442 for the related issue with globals.

      ~~~

      For Google: this issue is about workflow-cps-plugin a.k.a workflow-cps a.k.a. "Pipeline: Groovy" a.k.a "Pipeline Groovy Plugin", i.e. the "/pipeline-syntax/" page, the "Pipeline Syntax: Snippet Generator".

        Attachments

          Activity

          Hide
          ringerc Craig Ringer added a comment -

          It looks like the Descriptor abstract base that StepDescriptor extends exposes a getPlugin() method that would be ideal. AFAICS in src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly.

          I think it needs to inject  getPlugin().getDisplayName() hyperlinked to its getPlugin().getUrl(), and probably the step class's getSimpleName() too.

          I haven't figured out how to do that in jelly (I used JSF2 in a prior life, but I've never done jelly) and don't have a local Jenkins for testing yet. But hopefully this is a useful starting point. My wild guess is:

          In the <f:ajax> block, maybe after the end of the <st:include/> block, something like

          <j:set var="plugin" value="${descriptor.plugin}"/>
          <tr>
            <td colspan="3">
              Provided by class <tt>${descriptor.simpleName}</tt>
              <j:if test="${plugin != null}">
                <j:set var="pluginUrl" value="${plugin.url}"/>
                <j:set var="pluginName" value="${plugin.displayName}"/> 
                <j:if test="${pluginUrl == null}>
                  in plugin ${pluginName}.
                </j:if>
                <j:if test="${pluginUrl != null}>
                  in plugin <a href="${pluginUrl}">${pluginName}</a>.
                </j:if>
              </j:if>
            </td>
          </tr>
          

           
          I'd love a hand as I'm a bit stuck about how to get from this to testing it and sending a pull request.

          Show
          ringerc Craig Ringer added a comment - It looks like the Descriptor  abstract base that StepDescriptor extends exposes a getPlugin() method that would be ideal. AFAICS in  src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/index.jelly. I think it needs to inject   getPlugin().getDisplayName() hyperlinked to its getPlugin().getUrl() , and probably the step class's  getSimpleName() too. I haven't figured out how to do that in jelly (I used JSF2 in a prior life, but I've never done jelly) and don't have a local Jenkins for testing yet. But hopefully this is a useful starting point. My wild guess is: In the <f:ajax> block, maybe after the end of the <st:include/> block, something like <j:set var = "plugin" value= "${descriptor.plugin}" /> <tr> <td colspan= "3" > Provided by class <tt>${descriptor.simpleName}</tt> <j: if test= "${plugin != null }" > <j:set var = "pluginUrl" value= "${plugin.url}" /> <j:set var = "pluginName" value= "${plugin.displayName}" />  <j: if test="${pluginUrl == null }> in plugin ${pluginName}. </j: if > <j: if test="${pluginUrl != null }> in plugin <a href= "${pluginUrl}" >${pluginName}</a>. </j: if > </j: if > </td> </tr>   I'd love a hand as I'm a bit stuck about how to get from this to testing it and sending a pull request.

            People

            • Assignee:
              Unassigned
              Reporter:
              ringerc Craig Ringer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: