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

Non-multibranch pipelines do not have any changeset information

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • blueocean-plugin
    • None
    • Blue Ocean - Candidates

      Problem
      Non-multibranch pipelines do not have any changeset information

      Steps to reproduce

      1. Create a Pipeline using the Jenkinsfile below
      2. Run the Pipeline
      3. There is no revision information

      Jenkinsfile

      node {
        stage('checkout') {
          checkout([$class: 'SubversionSCM',
              locations: [[local: '.', remote: 'http://svn.apache.org/repos/asf/poi/trunk/sonar/']],
              workspaceUpdater: [$class: 'UpdateUpdater']
          ])
        }
      }
      

      Original request
      (See https://groups.google.com/forum/?utm_source=footer#!topic/jenkinsci-users/FwBdR0UB6Qc)

      In BlueOcean (v1.2.0) pipeline activity view the column 'COMMIT' always only shows a '-' (dash): 

      • Is that okay or what should be shown there?
      • Side note: it is a "Pipeline from SCM" using SVN.

      Please note that in the 'Changes' tab the SVN commit is nicely listed with SVN commit ID and message though:

          [JENKINS-46521] Non-multibranch pipelines do not have any changeset information

          Drew Easley added a comment -

          +1, We're seeing the same issue in our Jenkins instance.  Standard views show commit information, but Blue Ocean shows a hyphen for commit and branch being built. 

          Drew Easley added a comment - +1, We're seeing the same issue in our Jenkins instance.  Standard views show commit information, but Blue Ocean shows a hyphen for commit and branch being built. 

          (Note: IMHO this was unfortunately not solved by JENKINS-55497)

          Reinhold Füreder added a comment - (Note: IMHO this was unfortunately not solved by JENKINS-55497 )

          Stuart Rowe added a comment -

          reinholdfuereder thanks for bringing this to my attention. Unfortunately this seems to be an issue with other SCMs too (I'm using p4-plugin).

          Stuart Rowe added a comment - reinholdfuereder thanks for bringing this to my attention. Unfortunately this seems to be an issue with other SCMs too (I'm using p4-plugin).

          Gavin Mogan added a comment -

          Blueocean just renders whatever the other scm providers ... provide

          https://github.com/jenkinsci/jenkins/blob/2263ad03ab8aa481caa3918c8671b1d605514b15/core/src/main/java/hudson/scm/ChangeLogSet.java#L154-L169

          So If, and I mean if, i'm reading p4 correctly, it should have it set https://github.com/jenkinsci/p4-plugin/blob/d9a96a4c4d1d72de188e9470ebaad68202a7aa72/src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java#L343-L346

           

          Feel free to zip up a job (only probably need 1 builds), or give me a sample scm url i can try it with, and I'll try to run it through the debugger to look more into it, but I'm 90% certain its the scm provider not blueocean.

           

          Gavin Mogan added a comment - Blueocean just renders whatever the other scm providers ... provide https://github.com/jenkinsci/jenkins/blob/2263ad03ab8aa481caa3918c8671b1d605514b15/core/src/main/java/hudson/scm/ChangeLogSet.java#L154-L169 So If, and I mean if, i'm reading p4 correctly, it should have it set https://github.com/jenkinsci/p4-plugin/blob/d9a96a4c4d1d72de188e9470ebaad68202a7aa72/src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeEntry.java#L343-L346   Feel free to zip up a job (only probably need 1 builds), or give me a sample scm url i can try it with, and I'll try to run it through the debugger to look more into it, but I'm 90% certain its the scm provider not blueocean.  

          Gavin Mogan added a comment -

          Oh i see the url in the description, i can probably poke at it.

          Gavin Mogan added a comment - Oh i see the url in the description, i can probably poke at it.

          Gavin Mogan added a comment -

          https://github.com/jenkinsci/blueocean-plugin/blob/70083b199cf41486dd0559520f0764205ea67ac3/blueocean-pipeline-api-impl/src/main/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineRunImpl.java#L209-L216

          Looks like blueocean pulls the commit id from the run, using the SCMRevisionAction, which at least svn doesn't seem to populate.

           

          stephenconnolly jglick looks like you worked on  SCMRevisionAction, is that the right way to pull commit info for a run?  it looks like its only implemented in workflow-multibranch-plugin, literate-plugin and yaml-project-plugin. Are other scm providers supposed to implement this?

          Gavin Mogan added a comment - https://github.com/jenkinsci/blueocean-plugin/blob/70083b199cf41486dd0559520f0764205ea67ac3/blueocean-pipeline-api-impl/src/main/java/io/jenkins/blueocean/rest/impl/pipeline/PipelineRunImpl.java#L209-L216 Looks like blueocean pulls the commit id from the run, using the SCMRevisionAction, which at least svn doesn't seem to populate.   stephenconnolly jglick looks like you worked on  SCMRevisionAction, is that the right way to pull commit info for a run?  it looks like its only implemented in workflow-multibranch-plugin, literate-plugin and yaml-project-plugin. Are other scm providers supposed to implement this?

          Jesse Glick added a comment -

          SCMRevisionAction is specific to multibranch builds and represents the one commit which the multibranch folder is tracking and from which Jenkinsfile etc. are taken—what checkout scm would check out. If you have a non-multibranch project, including freestyle as well as Pipeline, or even want to account for SCM information from other checkout (incl. git) steps used in a multibranch build, you can use RunWithSCM.getChangeSets and ChangeLogSet.Entry.getCommitId.

          Jesse Glick added a comment - SCMRevisionAction is specific to multibranch builds and represents the one commit which the multibranch folder is tracking and from which Jenkinsfile etc. are taken—what checkout scm would check out. If you have a non-multibranch project, including freestyle as well as Pipeline, or even want to account for SCM information from other checkout (incl. git ) steps used in a multibranch build, you can use RunWithSCM.getChangeSets and ChangeLogSet.Entry.getCommitId .

          Jesse Glick added a comment -

          To be clear, RunWithSCM.getChangeSets should represent the complete changelog for this build, including whatever commits might be included in the diff of SCMRevisionAction from the previous build to this one, assuming checkout scm was run at least once. From a technical perspective, this issue is not a bug at all—the changelog is displayed if there is any (which there would not be for e.g. build #1 or if you just retriggered a build manually); and the unique commit ID is displayed if there is any (which there would not be for a non-multibranch build, since these may check out zero or more repositories in various revisions according to whim). It is just a design decision what sorts of metadata you wish to display in builds under various circumstances that you think would best match user expectations.

          Jesse Glick added a comment - To be clear, RunWithSCM.getChangeSets should represent the complete changelog for this build, including whatever commits might be included in the diff of SCMRevisionAction from the previous build to this one, assuming checkout scm was run at least once. From a technical perspective, this issue is not a bug at all—the changelog is displayed if there is any (which there would not be for e.g. build #1 or if you just retriggered a build manually); and the unique commit ID is displayed if there is any (which there would not be for a non-multibranch build, since these may check out zero or more repositories in various revisions according to whim). It is just a design decision what sorts of metadata you wish to display in builds under various circumstances that you think would best match user expectations.

          Gavin Mogan added a comment -

          Hrm. And that that brings up another point, pipelines can have multiple scms hooked up to it (multiple git repos, git and svn, what have you)....

          Maybe its better just to hide the column if its not a multi branch pipeline.

          Gavin Mogan added a comment - Hrm. And that that brings up another point, pipelines can have multiple scms hooked up to it (multiple git repos, git and svn, what have you).... Maybe its better just to hide the column if its not a multi branch pipeline.

          Thanks for the insider/background information (and the hint in JENKINS-44869):

          • well, yes, actually I (therefore) have the commit ID (SVN revision or shortened GIT commit hash) as suffix of my therefore quite long build display number, e.g. "20170613-161100-rev134098" (i.e. "<date>-<time>-rev<SVN revision>")
          • and thus hiding the "Commit" column for a non-multi branch pipeline in favour of showing the full build display number in the BO's activity tab "Run" id column (see JENKINS-44869) would be ideal/fine for me

          Reinhold Füreder added a comment - Thanks for the insider/background information (and the hint in JENKINS-44869 ): well, yes, actually I (therefore) have the commit ID (SVN revision or shortened GIT commit hash) as suffix of my therefore quite long build display number, e.g. "20170613-161100-rev134098" (i.e. "<date>-<time>-rev<SVN revision>") and thus hiding the "Commit" column for a non-multi branch pipeline in favour of showing the full build display number in the BO's activity tab "Run" id column (see JENKINS-44869 ) would be ideal/fine for me

            Unassigned Unassigned
            reinholdfuereder Reinhold Füreder
            Votes:
            11 Vote for this issue
            Watchers:
            16 Start watching this issue

              Created:
              Updated: