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

Prepend thread name to output

    XMLWordPrintable

Details

    • Improvement
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Fixed
    • pipeline

    Description

      When using parallel you might expect that the consolidated run output mentions the branch that each message comes from. This would require ParallelLabelAction to implement an API defining getBranchName so that copyLogs could prefix it, probably to each line:

      [sometests] Running shell script
      [othertests] Running shell script
      [sometests] + mvn test
      [othertests] + mvn test
      ...
      

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: tfennelly
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java
            api/src/main/java/org/jenkinsci/plugins/workflow/actions/BodyExecutionLabelAction.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-plugin/26c0b445561881be1296309e19a6ed5eb6b8e0ea
            Log:
            [FIXED JENKINS-26122] Prepend parallel step execution logs with the branch label

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java api/src/main/java/org/jenkinsci/plugins/workflow/actions/BodyExecutionLabelAction.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-plugin/26c0b445561881be1296309e19a6ed5eb6b8e0ea Log: [FIXED JENKINS-26122] Prepend parallel step execution logs with the branch label

            Code changed in jenkins
            User: tfennelly
            Path:
            CHANGES.md
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/WorkspaceStepTest.java
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
            cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStepExecution.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep.java
            support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/config.jelly
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/help-dir.html
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/config.jelly
            support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/help-quietPeriod.html
            support/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepTest.java
            http://jenkins-ci.org/commit/workflow-plugin/772063078e09d19adb881f4c5d52188c0ba36620
            Log:
            Merge branch 'master' into JENKINS-26122

            • master:
              JENKINS-27145 Noting #75 in changelog.
              Updating list of unavailable variables (again ).
              [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod.
              @tfennelly requests more descriptive variable names.
              Needed to update a test as well.
              [FIXED JENKINS-26072] Added WorkspaceStep.dir.
              Updating list of unavailable variables.
              Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page.

            Conflicts:
            CHANGES.md

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: CHANGES.md aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/WorkspaceStepTest.java cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStepExecution.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep.java support/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepExecution.java support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/config.jelly support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/WorkspaceStep/help-dir.html support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/config.jelly support/src/main/resources/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStep/help-quietPeriod.html support/src/test/java/org/jenkinsci/plugins/workflow/support/steps/build/BuildTriggerStepTest.java http://jenkins-ci.org/commit/workflow-plugin/772063078e09d19adb881f4c5d52188c0ba36620 Log: Merge branch 'master' into JENKINS-26122 master: JENKINS-27145 Noting #75 in changelog. Updating list of unavailable variables (again ). [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod. @tfennelly requests more descriptive variable names. Needed to update a test as well. [FIXED JENKINS-26072] Added WorkspaceStep.dir. Updating list of unavailable variables. Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page. Conflicts: CHANGES.md

            Code changed in jenkins
            User: tfennelly
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly
            http://jenkins-ci.org/commit/workflow-plugin/a5c5bf6fee6a306371c0b5c87f5e35a356f8fa85
            Log:
            Merge branch 'master' into JENKINS-26122

            • master:
              Always produce unique element and function names. Avoids a bug when switching between CpsFlowDefinition and CpsScmFlowDefinition.
              Allow the location of the element holding Snippetizer to be passed in.

            Compare: https://github.com/jenkinsci/workflow-plugin/compare/bb6a526703f3...a5c5bf6fee6a

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly http://jenkins-ci.org/commit/workflow-plugin/a5c5bf6fee6a306371c0b5c87f5e35a356f8fa85 Log: Merge branch 'master' into JENKINS-26122 master: Always produce unique element and function names. Avoids a bug when switching between CpsFlowDefinition and CpsScmFlowDefinition. Allow the location of the element holding Snippetizer to be passed in. Compare: https://github.com/jenkinsci/workflow-plugin/compare/bb6a526703f3...a5c5bf6fee6a
            anshuarya Anshu Arya added a comment - - edited

            Output after the first node block is not labeled.

            In my use case I call various nodes during a parallel execution step, but here is a contrived example just using the master node:

            threads = ['thread1','thread2']
            def branches = [:]
            for(int i = 0; i < threads.size(); i++) {
            def thread = threads[i]
                branches[thread] = {
                    println 'labeled'
                    node('master') {println "labeled"}
                    println 'not labeled'
                    node('master') {println "also not labeled"}
                }
            }
            parallel branches
            

            Results in:

            Running: Execute sub-workflows in parallel : Start
            [thread1] Running: Parallel branch: thread1
            [thread2] Running: Parallel branch: thread2
            [thread1] Running: Print Message
            [thread1] labeled
            [thread1] Running: Allocate node : Start
            [thread1] Running on master in /var/lib/jenkins/workspace/test@3
            [thread2] Running: Print Message
            [thread2] labeled
            [thread2] Running: Allocate node : Start
            [thread2] Running on master in /var/lib/jenkins/workspace/test@4
            [thread1] Running: Allocate node : Body : Start
            [thread2] Running: Allocate node : Body : Start
            [thread1] Running: Print Message
            [thread1] labeled
            Running: Allocate node : Body : End
            [thread2] Running: Print Message
            [thread2] labeled
            Running: Allocate node : Body : End
            Running: Allocate node : End
            Running: Allocate node : End
            Running: Print Message
            not labeled
            Running: Allocate node : Start
            Running on master in /var/lib/jenkins/workspace/test@3
            Running: Print Message
            not labeled
            Running: Allocate node : Start
            Running on master in /var/lib/jenkins/workspace/test@4
            Running: Allocate node : Body : Start
            Running: Allocate node : Body : Start
            Running: Print Message
            also not labeled
            Running: Allocate node : Body : End
            Running: Print Message
            also not labeled
            Running: Allocate node : Body : End
            Running: Allocate node : End
            Running: Allocate node : End
            Running: Execute sub-workflows in parallel : Body : End
            Running: Execute sub-workflows in parallel : Body : End
            Running: Execute sub-workflows in parallel : End
            Running: End of Workflow
            Finished: SUCCESS
            
            anshuarya Anshu Arya added a comment - - edited Output after the first node block is not labeled. In my use case I call various nodes during a parallel execution step, but here is a contrived example just using the master node: threads = ['thread1','thread2'] def branches = [:] for(int i = 0; i < threads.size(); i++) { def thread = threads[i] branches[thread] = { println 'labeled' node('master') {println "labeled"} println 'not labeled' node('master') {println "also not labeled"} } } parallel branches Results in: Running: Execute sub-workflows in parallel : Start [thread1] Running: Parallel branch: thread1 [thread2] Running: Parallel branch: thread2 [thread1] Running: Print Message [thread1] labeled [thread1] Running: Allocate node : Start [thread1] Running on master in /var/lib/jenkins/workspace/test@3 [thread2] Running: Print Message [thread2] labeled [thread2] Running: Allocate node : Start [thread2] Running on master in /var/lib/jenkins/workspace/test@4 [thread1] Running: Allocate node : Body : Start [thread2] Running: Allocate node : Body : Start [thread1] Running: Print Message [thread1] labeled Running: Allocate node : Body : End [thread2] Running: Print Message [thread2] labeled Running: Allocate node : Body : End Running: Allocate node : End Running: Allocate node : End Running: Print Message not labeled Running: Allocate node : Start Running on master in /var/lib/jenkins/workspace/test@3 Running: Print Message not labeled Running: Allocate node : Start Running on master in /var/lib/jenkins/workspace/test@4 Running: Allocate node : Body : Start Running: Allocate node : Body : Start Running: Print Message also not labeled Running: Allocate node : Body : End Running: Print Message also not labeled Running: Allocate node : Body : End Running: Allocate node : End Running: Allocate node : End Running: Execute sub-workflows in parallel : Body : End Running: Execute sub-workflows in parallel : Body : End Running: Execute sub-workflows in parallel : End Running: End of Workflow Finished: SUCCESS
            jglick Jesse Glick added a comment -

            anshuarya please leave this closed and file any special cases as separate issues with the JIRA “blocking” link.

            jglick Jesse Glick added a comment - anshuarya please leave this closed and file any special cases as separate issues with the JIRA “blocking” link.

            Code changed in jenkins
            User: tfennelly
            Path:
            aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java
            cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/2aafd8797ba02f43de847c463bd278343dcb633e
            Log:
            [FIXED JENKINS-26122] Prepend parallel step execution logs with the branch label

            Originally-Committed-As: 26c0b445561881be1296309e19a6ed5eb6b8e0ea

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: aggregator/src/test/java/org/jenkinsci/plugins/workflow/steps/parallel/ParallelStepTest.java cps/src/main/java/org/jenkinsci/plugins/workflow/cps/steps/ParallelStep.java http://jenkins-ci.org/commit/workflow-cps-plugin/2aafd8797ba02f43de847c463bd278343dcb633e Log: [FIXED JENKINS-26122] Prepend parallel step execution logs with the branch label Originally-Committed-As: 26c0b445561881be1296309e19a6ed5eb6b8e0ea

            Code changed in jenkins
            User: tfennelly
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html
            cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/6577037dfc574ec618f3475936081dc3bb223dd8
            Log:
            Merge branch 'master' into JENKINS-26122

            • master:
              JENKINS-27145 Noting #75 in changelog.
              Updating list of unavailable variables (again ).
              [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod.
              @tfennelly requests more descriptive variable names.
              Needed to update a test as well.
              [FIXED JENKINS-26072] Added WorkspaceStep.dir.
              Updating list of unavailable variables.
              Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page.

            Conflicts:
            CHANGES.md

            Originally-Committed-As: 772063078e09d19adb881f4c5d52188c0ba36620

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsFlowDefinition/help-script.html cps/src/test/java/org/jenkinsci/plugins/workflow/cps/SnippetizerTest.java http://jenkins-ci.org/commit/workflow-cps-plugin/6577037dfc574ec618f3475936081dc3bb223dd8 Log: Merge branch 'master' into JENKINS-26122 master: JENKINS-27145 Noting #75 in changelog. Updating list of unavailable variables (again ). [FIXED JENKINS-26692] Added BuildTriggerStep.quietPeriod. @tfennelly requests more descriptive variable names. Needed to update a test as well. [FIXED JENKINS-26072] Added WorkspaceStep.dir. Updating list of unavailable variables. Linking to environment variable (${rootURL}/env-vars.html) in the workflow script help page. Conflicts: CHANGES.md Originally-Committed-As: 772063078e09d19adb881f4c5d52188c0ba36620

            Code changed in jenkins
            User: tfennelly
            Path:
            cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly
            http://jenkins-ci.org/commit/workflow-cps-plugin/f36312e42c21dc4d2aedb08a0e5369ccd28ee630
            Log:
            Merge branch 'master' into JENKINS-26122

            • master:
              Always produce unique element and function names. Avoids a bug when switching between CpsFlowDefinition and CpsScmFlowDefinition.
              Allow the location of the element holding Snippetizer to be passed in.

            Originally-Committed-As: a5c5bf6fee6a306371c0b5c87f5e35a356f8fa85

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: cps/src/main/resources/org/jenkinsci/plugins/workflow/cps/Snippetizer/block.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/f36312e42c21dc4d2aedb08a0e5369ccd28ee630 Log: Merge branch 'master' into JENKINS-26122 master: Always produce unique element and function names. Avoids a bug when switching between CpsFlowDefinition and CpsScmFlowDefinition. Allow the location of the element holding Snippetizer to be passed in. Originally-Committed-As: a5c5bf6fee6a306371c0b5c87f5e35a356f8fa85

            Code changed in jenkins
            User: tfennelly
            Path:
            job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java
            http://jenkins-ci.org/commit/workflow-job-plugin/a5083cc45a81f4fed9fb144f23924b046ae9951f
            Log:
            [FIXED JENKINS-26122] Prepend parallel step execution logs with the branch label

            Originally-Committed-As: 26c0b445561881be1296309e19a6ed5eb6b8e0ea

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: tfennelly Path: job/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java http://jenkins-ci.org/commit/workflow-job-plugin/a5083cc45a81f4fed9fb144f23924b046ae9951f Log: [FIXED JENKINS-26122] Prepend parallel step execution logs with the branch label Originally-Committed-As: 26c0b445561881be1296309e19a6ed5eb6b8e0ea

            People

              tfennelly Tom FENNELLY
              jglick Jesse Glick
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: