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

Log / document the plugin usage in the flow nodes

      Jenkins adds the plugin names and versions to the XML configuration, e.g. like plugin="groovy@1.27". Analyzing config.xml files it is possible to see what pluins are used by a job.

      With workflow this is not possible, since the information what plugin is used, is in the script file. It is probably difficult to analyze the script statically and extract plugin information.

      However, when a script is executed, workflow has the needed information. The steps are already logged to builds/<job-id>/workflow/<step-id>.xml.

      For a git checkout, via the generic SCM API it logs:

      <?xml version='1.0' encoding='UTF-8'?>
      <org.jenkinsci.plugins.workflow.support.storage.SimpleXStreamFlowNodeStorage_-Tag plugin="workflow-support@1.11">
        <node class="org.jenkinsci.plugins.workflow.cps.nodes.StepAtomNode" plugin="workflow-cps@1.11">
          <parents class="com.google.common.collect.ImmutableList">
            <org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode>5</org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode>
          </parents>
          <id>6</id>
          <descriptorId>org.jenkinsci.plugins.workflow.steps.scm.GenericSCMStep</descriptorId>
        </node>
      ...
      

      Improvement:

      Each step node contains also the used plugin(s) and version. In the above case it needs to log workflow-scm-step and git.

          [JENKINS-31582] Log / document the plugin usage in the flow nodes

          Jens Wilke created issue -
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-33995 [ JENKINS-33995 ]
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-34002 [ JENKINS-34002 ]
          Jesse Glick made changes -
          Labels New: api

          Jesse Glick added a comment -

          Suggested generalization of API: a new Action to be attached to a StepNode which records the step function name and its configuration in the format understood by DescribableModel. Helper methods could try to reconstruct the actual Step object, or produce a list of plugins involved in its definition.

          Would lead to more storage being used by the flow graph, but I think it is not too bad, so long as people refrain from putting ten-page shell scripts inline in their Jenkinsfile (anything complex should anyway be moved to a separate file). There are a lot of potential features related to visualization and analysis which could benefit from access to the detailed step definition.

          Jesse Glick added a comment - Suggested generalization of API: a new Action to be attached to a StepNode which records the step function name and its configuration in the format understood by DescribableModel . Helper methods could try to reconstruct the actual Step object, or produce a list of plugins involved in its definition. Would lead to more storage being used by the flow graph, but I think it is not too bad, so long as people refrain from putting ten-page shell scripts inline in their Jenkinsfile (anything complex should anyway be moved to a separate file). There are a lot of potential features related to visualization and analysis which could benefit from access to the detailed step definition.

          Jesse Glick added a comment -

          (Currently StepAtomNode and StepStartNode record a descriptorId, which could be deprecated in favor of the new action, without breaking compatibility for callers of StepNode.getDescriptor().)

          Jesse Glick added a comment - (Currently StepAtomNode and StepStartNode record a descriptorId , which could be deprecated in favor of the new action, without breaking compatibility for callers of StepNode.getDescriptor() .)
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-28293 [ JENKINS-28293 ]
          Jesse Glick made changes -
          Epic Link New: JENKINS-35400 [ 171193 ]
          Jesse Glick made changes -
          Link New: This issue is blocking JENKINS-29922 [ JENKINS-29922 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 167007 ] New: JNJira + In-Review [ 182547 ]

            jglick Jesse Glick
            cruftex Jens Wilke
            Votes:
            4 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: