jenkinsci / pipeline-graph-view-plugin

https://plugins.jenkins.io/pipeline-graph-view/
Other
109 stars 56 forks source link

Steps inside parallel stages are not rendered #310

Closed TobiX closed 7 months ago

TobiX commented 10 months ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.426.1 OS: Linux - 6.1.0-13-amd64 Java: 17.0.9 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- Office-365-Connector:4.20.2 amazon-ecr:1.114.vfd22430621f5 analysis-model-api:11.13.0 ansicolor:1.0.4 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 authentication-tokens:1.53.v1c90fd9191a_b_ aws-credentials:218.v1b_e9466ec5da_ aws-java-sdk-ec2:1.12.606-418.vce5b_4cd017c6 aws-java-sdk-ecr:1.12.606-418.vce5b_4cd017c6 aws-java-sdk-minimal:1.12.606-418.vce5b_4cd017c6 azure-ad:442.v355cca_6b_c169 azure-sdk:157.v855da_0b_eb_dc2 bootstrap5-api:5.3.2-3 bouncycastle-api:2.30.1.77-225.v26ea_c9455fd9 branch-api:2.1135.v8de8e7899051 build-monitor-plugin:1.14-745.ve2023a_305f40 build-user-vars-plugin:1.9 buildtriggerbadge:251.vdf6ef853f3f5 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-folder:6.858.v898218f3609d commons-httpclient3-api:3.1-3 commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.11.0-95.v22a_d30ee5d36 compact-columns:1.185.vf3851b_4d31fe config-file-provider:959.vcff671a_4518b_ copyartifact:722.v0662a_9b_e22a_c coverage:1.6.0 credentials:1309.v8835d63eb_d8a_ credentials-binding:642.v737c34dea_6c2 customizable-header:61.v9c97c69b_7ee3 dark-theme:403.v9b_c3e80ceb_f6 dashboard-view:2.495.v07e81500c3f2 data-tables-api:1.13.8-2 database:191.vd5981b_97a_5fa_ database-postgresql:100.v2418e0a_c6909 display-url-api:2.200.vb_9327d658781 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:572.v950f58993843 downstream-build-cache:1.7 durable-task:523.va_a_22cf15d5e0 echarts-api:5.4.3-2 email-ext:2.102 embeddable-build-status:412.v09da_db_1dee68 extra-columns:1.26 favorite:2.4.3 flyway-api:9.22.3-17.v29827d185b_d7 font-awesome-api:6.5.1-1 forensics-api:2.3.0 git:5.2.1 git-client:4.6.0 git-forensics:2.0.0 git-parameter:0.9.19 gitlab-api:5.3.0-91.v1f9a_fda_d654f gitlab-branch-source:684.vea_fa_7c1e2fe3 gitlab-scm-filter-aged-refs:39.ve2e68cc3fa_78 groovy:457.v99900cb_85593 gson-api:2.10.1-3.vb_25b_599b_e4f8 h2-api:11.1.4.199-12.v9f4244395f7a_ handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.32 instance-identity:185.v303dc7c645f9 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.3-372.v309620682326 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.9-1 jersey2-api:2.41-133.va_03323b_a_1396 jira:3.12 job-dsl:1.87 jobConfigHistory:1229.v3039470161a_d jquery3-api:3.7.1-1 junit:1240.vf9529b_881428 junit-attachments:205.vc0677977deb_0 junit-sql-storage:282.v0b_9d0f91b_cec kubernetes:4147.va_d406fb_66172 kubernetes-client-api:6.8.1-224.vd388fca_4db_3b_ kubernetes-credentials:0.11 lockable-resources:1218.va_3dd45e2b_fa_7 mailer:463.vedf8358e006b_ mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.2.1 matrix-project:818.v7eb_e657db_924 metrics:4.2.18-442.v02e107157925 mina-sshd-api-common:2.11.0-86.v836f585d47fa_ mina-sshd-api-core:2.11.0-86.v836f585d47fa_ okhttp-api:4.11.0-157.v6852a_a_fa_ec11 performance:951.v5600a_c6422ed pipeline-build-step:516.v8ee60a_81c5b_9 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-graph-view:205.vb_8e3a_b_51f12e pipeline-groovy-lib:689.veec561a_dee13 pipeline-input-step:477.v339683a_8d55e pipeline-maven:1362.vee39a_d4b_02b_1 pipeline-maven-api:1362.vee39a_d4b_02b_1 pipeline-maven-database:1362.vee39a_d4b_02b_1 pipeline-model-api:2.2151.ve32c9d209a_3f pipeline-model-definition:2.2151.ve32c9d209a_3f pipeline-model-extensions:2.2151.ve32c9d209a_3f pipeline-rest-api:2.34 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2151.ve32c9d209a_3f pipeline-stage-view:2.34 pipeline-utility-steps:2.16.0 plain-credentials:143.v1b_df8b_d3b_e48 platformlabeler:2325.v8f074df8840d plugin-util-api:3.6.0 postgresql-api:42.6.0-31.vb_7e76dc13969 prism-api:1.29.0-10 role-strategy:689.v731678c3e0eb_ s3:466.vf5b_3db_8e3eb_2 scm-api:683.vb_16722fb_b_80b_ script-security:1294.v99333c047434 simple-theme-plugin:176.v39740c03a_a_f5 snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.16.1 ssh-agent:346.vda_a_c4f2c8e50 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.916.vd17b_43357ce4 sshd:3.312.v1c601b_c83b_0e structs:325.vcb_307d2a_2782 subversion:2.17.3 test-results-analyzer:0.4.1 text-finder:1.26 theme-manager:215.vc1ff18d67920 timestamper:1.26 token-macro:384.vf35b_f26814ec trilead-api:2.84.v72119de229b_7 variant:60.v7290fc0eb_b_cd versioncolumn:221.vdb_638ece0951 view-job-filters:369.ve0513a_a_f5524 warnings-ng:10.5.2 workflow-api:1283.v99c10937efcb_ workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3821.v9d3888c583b_1 workflow-durable-task-step:1289.v4d3e7b_01546b_ workflow-job:1385.vb_58b_86ea_fff1 workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:865.v43e78cc44e0d yet-another-build-visualizer:1.16 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Linux (Debian 12, amd64)

Reproduction steps

Run this pipeline:

def projects = [
  ["l0a"],
  ["l1a", "l1b", "l1c", "l1d", "l1e", "l1f", "l1g"],
  ["l2a", "l2b", "l2c"],
  ["l3a"],
  ["l4a", "l4b", "l4c", "l4d"],
  ["l5a"]
]

node {
  projects.eachWithIndex { levelProjects, level ->
    stage("Non-parallel ${level}") {
      isUnix()
    }

    def jobs = [failFast: false]
      levelProjects.each { project ->
        jobs[project] = {
          stage("Build ${project}") {
            dir(project) {
              isUnix()
            }
          }
        }
      }
    parallel jobs
  }
}

Expected Results

All steps are rendered regardless if they are inside parallel stages or not:

grafik

Actual Results

While the parallel stages are rendered, all steps inside the stages are not:

grafik

Anything else?

I have looked at other issues, but while #51 sounds similar, this isn't about nested parallel execution, but just "simple" parallel execution...

Are you interested in contributing a fix?

No response

sirikon commented 8 months ago

I'm facing this issue as well. In my case it just happens during the execution of the steps, which render correctly once they've finished.

I've found that doing parallel steps this way dodges the issue:

stage("Run Tests") {
    steps {
        script {
            parallel ([
                'Unitary tests': {
                    sh "..."
                },
                'Integration tests': {
                    sh "..."
                },
                'Acceptance tests': {
                    sh "..."
                }
            ])
        }
    }
}
puetzk commented 8 months ago

Yep. I'm seeing this too (Jenkins 2.426.3 LTS, pipeline-graph-view-plugin 215.vc0ea_557e4d6f): if there's multiple stages inside each parallel branch, they only start to render correctly after the first stage has finished (or, probably, once the second one has started - that's ~simultaneous so it's hard to tell). At that point it also switches from showing the parallel branch name on the node itself, and instead moves it to the branch's line.

When all the parallel branches are within their "Build" stage, the parallel labels display as stage nodes image And no steps are seen below the heading; "view as plain text" just says "No logs found" (presumably per #324) image

Once a branch finishes stage('Build') and starts stage('Test'), that branch changes appearance - the x86-windows-msvc143 label (or whichever branch) now displays on the line itself, and the nodes are the Build/Test/etc image Clicking on those nodes goes to a working view that can see their steps and output messages. image

This change happens to one branch a at a time (as they finish up their first stage and move on); by the end of the job everything's working.

So it's acting like there's some special case, and when it's only seen one stage within a parallel branch, it tries to combine its representation of stage with the branch itself. And since that isn't how the steps are actually parented, that's presumably why it can't find any of the steps (or their output).

timja commented 7 months ago

Appears to be fixed by https://github.com/jenkinsci/pipeline-graph-view-plugin/pull/285

Would anyone care to test it and see if it fixes the issue for them? (it'll be released soon once a couple of minor issues are sorted)

image
TobiX commented 7 months ago

@timja I can confirm that with https://repo.jenkins-ci.org/incrementals/io/jenkins/plugins/pipeline-graph-view/259.v976201fedecd/ both my synthetic test (the reproducer from this ticket) and the original pipeline I noticed the problem in are fixed. 👍

puetzk commented 6 months ago

Confirmed, 232.vc7ca_8d934725 fixed the case I reported as well.