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

Ability to decorate Pipeline builds as a global extension

      See JENKINS-30777. Does not currently work from WorkflowRun.

          [JENKINS-45693] Ability to decorate Pipeline builds as a global extension

          Jesse Glick added a comment -

          Any patch now would be likely to conflict in a minor way with JENKINS-38381.

          Jesse Glick added a comment - Any patch now would be likely to conflict in a minor way with JENKINS-38381 .

          Jesse Glick added a comment -

          Actually ought to be done in LogActionImpl.stream; and then under JENKINS-38381 in AnnotatedLogAction.DecoratedTaskListener. The latter could only support filters which are also Serializable (the same restriction as already exists for ConsoleLogFilter objects applied contextually), so to avoid behavioral changes this restriction should also be enforced in LogActionImpl. That means plugins registering such an extension, in order to be compatible with Pipeline, would need to ensure that it implements Serializable as well as overriding the new overload taking Run.

          Jesse Glick added a comment - Actually ought to be done in LogActionImpl.stream ; and then under JENKINS-38381 in  AnnotatedLogAction.DecoratedTaskListener . The latter could only support filters which are also Serializable (the same restriction as already exists for ConsoleLogFilter objects applied contextually ), so to avoid behavioral changes this restriction should also be enforced in LogActionImpl . That means plugins registering such an extension, in order to be compatible with Pipeline, would need to ensure that it implements Serializable as well as overriding the new overload taking Run .

          Jesse Glick added a comment -

          (Pipeline code could however print a warning to the log file when encountering a filter which fails to be serializable and/or override the correct overload.)

          Jesse Glick added a comment - (Pipeline code could however print a warning to the log file when encountering a filter which fails to be serializable and/or override the correct overload.)

          Markus Winter added a comment - - edited

          The drawback of doing it in LogActionImpl.stream is that this will not capture the complete output. What is missing is the started and finished messages from the listener and the intermediate output with the prefix. While the prefixed output is probably not that important, having the started by and the finished message when for example using the logstash plugin I would consider important. Not sure if JENKINS-38381 would solve that.

          Markus Winter added a comment - - edited The drawback of doing it in LogActionImpl.stream is that this will not capture the complete output. What is missing is the started and finished messages from the listener and the intermediate output with the prefix. While the prefixed output is probably not that important, having the started by and the finished message when for example using the logstash plugin I would consider important. Not sure if JENKINS-38381 would solve that.

          Jesse Glick added a comment -

          It would.

          Jesse Glick added a comment - It would.

          Code changed in jenkins
          User: Markus Winter
          Path:
          pom.xml
          src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConsoleLogFilter.java
          http://jenkins-ci.org/commit/mask-passwords-plugin/ba1c3781e91c18c6c57d96c3022eec9f66b48f8f
          Log:
          use modern api in ConsoleLogFilter

          When enabled globally it should work with all types of Jobs, also
          pipelines once JENKINS-45693 is fixed.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Markus Winter Path: pom.xml src/main/java/com/michelin/cio/hudson/plugins/maskpasswords/MaskPasswordsConsoleLogFilter.java http://jenkins-ci.org/commit/mask-passwords-plugin/ba1c3781e91c18c6c57d96c3022eec9f66b48f8f Log: use modern api in ConsoleLogFilter When enabled globally it should work with all types of Jobs, also pipelines once JENKINS-45693 is fixed.

          Jesse Glick added a comment -

          ConsoleLogFilter itself did not work out; filed PRs introducing a better API.

          Jesse Glick added a comment - ConsoleLogFilter itself did not work out; filed PRs introducing a better API.

          Jesse Glick added a comment -

          when for example using the logstash plugin

          …though this is an invalid use case. JEP-210 has direct support for external log storage. There is work underway on a Logstash implementation, not based on the existing plugin.

          Jesse Glick added a comment - when for example using the logstash plugin …though this is an invalid use case. JEP-210 has direct support for external log storage. There is work underway on a Logstash implementation, not based on the existing plugin.

          Jesse Glick added a comment -

          Released in beta.

          Jesse Glick added a comment - Released in beta.

          Timm Drevensek added a comment - - edited

          Hey jglick, any chance you can release this feature?

          Timm Drevensek added a comment - - edited Hey jglick , any chance you can release this feature?

          Jesse Glick added a comment -

          It already is. You do need to

          <useBeta>true</useBeta>
          

          to acknowledge that you are consuming an experimental API.

          Jesse Glick added a comment - It already is. You do need to <useBeta> true </useBeta> to acknowledge that you are consuming an experimental API.

          jglick - where would I specify the useBeta tag to enable this? 

          Richard Schaefer added a comment - jglick - where would I specify the useBeta tag to enable this? 

          Jesse Glick added a comment -

          rschaeferhig inside <properties> in the POM. Note however that workflow-api #97, if merged & released, would avoid the need for this.

          Jesse Glick added a comment - rschaeferhig inside <properties> in the POM. Note however that workflow-api #97, if merged & released, would avoid the need for this.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            8 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: