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

Pipeline-Stage-View Plugin is unable to show stage logs when Splunk Plugin for Jenkins is Enabled

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: splunk-devops-plugin
    • Labels:
    • Environment:
      Direct Jenkins 2.74 installed via RPM on RHEL 7 64-bit machine;
      JDKs installed in the system: JDK8, JDK7, JDK6
      Build-Pipeline-Plugin version: 1.5.8
      Splunk-Devops-Plugin: 1.6.4
      Pipeline-Stage-view-Plugin: 2.9
    • Similar Issues:

      Description

      When the Splunk Plugin and Splunk Plugin Extension (for pipeline jobs) are enabled, the stage logs are missing in the pipeline jobs. This is very simple to recreate:

      1. Install the required plugins so that one can create pipeline jobs. I am assuming Build Pipeline and Pipeline Stage View plugins are good enough.
      2. Install latest Splunk Plugin along with Splunk Plugin Extension. Configure it to be used with one Splunk instance. Now disable that once configuration is done.
      3. Create a simple pipeline job using below mentioned script:

      ++++++++++++++++++++++++++  

            pipeline {
      agent any
      options {
      timeout(time: 1, unit: 'HOURS')
      sendSplunkConsoleLog()
      }
      stages {
             stage("Build"){
                  steps {
                      script {
                          currentBuild.displayName = "SAMPLE_PIPELINE"
                          currentBuild.description = "The dummy pipeline job for Splunk"
                      }
                      echo 'Sample Pipeline for Test'
                  }
              }
        stage("Deploy"){
                  steps {
                       echo 'Sample Pipeline Deployed'
                  }
              }
        stage("Testing"){
                  steps {
                       echo 'Sample Pipeline Tested'
                  }
              }
      }
      }

      ++++++++++++++++++++++++++++++++++++++++++++

      4. Trigger the sample pipeline created above. Hover over build or deploy or testing stages in the pipeline stage view and you will get logs link. Clicking on the link, you will get appropriate log message as mentioned above in the pipeline script.

      5. Now enable the Splunk plugin from <Jenkins_url>/configure page.

      6. Again trigger the sample pipeline. This time when you click on the stage log link, you will not see the respective log messages as per the build stage.

       

        Attachments

          Activity

          Hide
          svanoort Sam Van Oort added a comment -

          This is an issue with the Splunk Devops plugin, not Stage View – Stage View just does a fetch-from-disk for the logfile associated with a FlowNode. If logs do not show up with the Splunk DevOps plugin enabled, something that plugin is doing is messing with the normal logging process.

          Ted Xiao Please can you take a look? Thanks.

          Show
          svanoort Sam Van Oort added a comment - This is an issue with the Splunk Devops plugin, not Stage View – Stage View just does a fetch-from-disk for the logfile associated with a FlowNode. If logs do not show up with the Splunk DevOps plugin enabled, something that plugin is doing is messing with the normal logging process. Ted Xiao Please can you take a look? Thanks.
          Hide
          fengxx Ted Xiao added a comment -

          I think it is related to state view caching.
          the ID.log is created on disk and can be viewed by "pipeline steps" (flowGraphTable) -> Select step -> Select Log

          The stage view log only works if
          1) rename the job to another folder using the same name
          2) restart jenkins

          What "sendSplunkConsoleLog" does is

                  @Override
                  public boolean start() throws Exception {
                      //refer to WithContextStep implementation
                      StepContext context = getContext();
                      Run run = context.get(Run.class);
                      ConsoleLogFilter filter = BodyInvoker.mergeConsoleLogFilters(context.get(ConsoleLogFilter.class), new TeeConsoleLogFilter(run));
                      context.newBodyInvoker().withContext(filter).withCallback(BodyExecutionCallback.wrap(context)).start();
                      return false;
                  }
          
          Show
          fengxx Ted Xiao added a comment - I think it is related to state view caching. the ID.log is created on disk and can be viewed by "pipeline steps" (flowGraphTable) -> Select step -> Select Log The stage view log only works if 1) rename the job to another folder using the same name 2) restart jenkins What "sendSplunkConsoleLog" does is @Override public boolean start() throws Exception { //refer to WithContextStep implementation StepContext context = getContext(); Run run = context.get(Run.class); ConsoleLogFilter filter = BodyInvoker.mergeConsoleLogFilters(context.get(ConsoleLogFilter.class), new TeeConsoleLogFilter(run)); context.newBodyInvoker().withContext(filter).withCallback(BodyExecutionCallback.wrap(context)).start(); return false ; }
          Hide
          fengxx Ted Xiao added a comment - - edited

          LogActionImpl does exist in workflow xml

          1) The log link is missing if called by runs?fullStages=true&_=1525254291848
          2) The log link can be retrieved via individual rest api, such as /job/debug/job/stage_view_debug/7/execution/node/15/wfapi/describe

          The xml is

          more 15.xml
          <?xml version='1.1' encoding='UTF-8'?>
          <Tag plugin="workflow-support@2.18">
            <node class="cps.n.StepAtomNode" plugin="workflow-cps@2.45">
              <parentIds>
                <string>14</string>
              </parentIds>
              <id>15</id>
              <descriptorId>org.jenkinsci.plugins.workflow.steps.EchoStep</descriptorId>
            </node>
            <actions>
              <wf.a.TimingAction plugin="workflow-api@2.25">
                <startTime>1525244349821</startTime>
              </wf.a.TimingAction>
              <s.a.LogActionImpl>
                <charset>UTF-8</charset>
              </s.a.LogActionImpl>
              <cps.a.ArgumentsActionImpl plugin="workflow-cps@2.45">
                <arguments class="linked-hash-map">
                  <entry>
                    <string>message</string>
                    <string>Sample Pipeline for Test</string>
                  </entry>
                </arguments>
                <isUnmodifiedBySanitization>true</isUnmodifiedBySanitization>
              </cps.a.ArgumentsActionImpl>
            </actions>
          </Tag>
          
          Show
          fengxx Ted Xiao added a comment - - edited LogActionImpl does exist in workflow xml 1) The log link is missing if called by runs?fullStages=true &_=1525254291848 2) The log link can be retrieved via individual rest api, such as /job/debug/job/stage_view_debug/7/execution/node/15/wfapi/describe The xml is more 15.xml <?xml version= '1.1' encoding= 'UTF-8' ?> <Tag plugin= "workflow-support@2.18" > <node class= "cps.n.StepAtomNode" plugin= "workflow-cps@2.45" > <parentIds> <string>14</string> </parentIds> <id>15</id> <descriptorId>org.jenkinsci.plugins.workflow.steps.EchoStep</descriptorId> </node> <actions> <wf.a.TimingAction plugin= "workflow-api@2.25" > <startTime>1525244349821</startTime> </wf.a.TimingAction> <s.a.LogActionImpl> <charset>UTF-8</charset> </s.a.LogActionImpl> <cps.a.ArgumentsActionImpl plugin= "workflow-cps@2.45" > <arguments class= "linked-hash-map" > <entry> <string>message</string> <string>Sample Pipeline for Test</string> </entry> </arguments> <isUnmodifiedBySanitization> true </isUnmodifiedBySanitization> </cps.a.ArgumentsActionImpl> </actions> </Tag>
          Hide
          fengxx Ted Xiao added a comment -

          Sam Van Oort could you shed some lights on the issue

          Show
          fengxx Ted Xiao added a comment - Sam Van Oort could you shed some lights on the issue
          Hide
          apurv_raj Apurv Raj added a comment -

          I dont see any action on this issue. Raising the priority to blocker as becasue of this issue, we are unable to use Jenkins App in Splunk. We should try to get this fixed asap.

          Show
          apurv_raj Apurv Raj added a comment - I dont see any action on this issue. Raising the priority to blocker as becasue of this issue, we are unable to use Jenkins App in Splunk. We should try to get this fixed asap.
          Hide
          svanoort Sam Van Oort added a comment -

          Apurv Raj Have you tried the Stage View 2.10 upgrade? This looks like it may be a URL generation quirk somehow triggered by something the Splunk Plugin does – the 2.10 update includes at least some fixes to URL generation logic in Stage View.

          Show
          svanoort Sam Van Oort added a comment - Apurv Raj Have you tried the Stage View 2.10 upgrade? This looks like it may be a URL generation quirk somehow triggered by something the Splunk Plugin does – the 2.10 update includes at least some fixes to URL generation logic in Stage View.
          Hide
          fengxx Ted Xiao added a comment -

          fixed in splunk-devops 1.7.1

          Show
          fengxx Ted Xiao added a comment - fixed in splunk-devops 1.7.1

            People

            Assignee:
            fengxx Ted Xiao
            Reporter:
            apurv_raj Apurv Raj
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: