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

SCM Changelog: Commits, made via github, displayed with "noreply" user

      Steps:

      1. Create Pipeline job for any project on github.
        node {
           def mvnHome
           stage('Preparation') { 
              git 'https://github.com/user-github/project.git'           
              mvnHome = tool 'M3'
           }
           stage('Build') {
              if (isUnix()) {
                 sh "'${mvnHome}/bin/mvn' -Dmaven.test.failure.ignore clean package"
              } else {
                 bat(/"${mvnHome}\bin\mvn" -Dmaven.test.failure.ignore clean package/)
              }
           stage('Results') {
              junit '**/target/surefire-reports/TEST-*.xml'
              archive 'target/*.jar'
           }
        }
        
      2. Open this project on github.
      3. Edit any files via the web interface. Commit.
      4. Run this job.
      5. Check Recent Changes:
        Expected Result: Recent changes have been made the correct user from github.
        Actual Result: Recent changes have been made the "noreply" user.
        Correct git log:
        commit 497fb99ae5c481f72ea34fa2e190afa908660798
        Author: ksenia-nenasheva <ks.nenasheva@gmail.com>
        Date:   Tue Oct 4 14:46:24 2016 +0200
        
            Update Jenkinsfile
        
        commit bbf860b9a6c7a28208b717d42e6f8665b21063a8
        Author: ksenia-nenasheva <ks.nenasheva@gmail.com>
        Date:   Tue Oct 4 14:18:41 2016 +0200
        
            Update Jenkinsfile
        
        commit 7312064526032f050b04335b4676b27b48a698f0
        Author: ksenia-nenasheva <ks.nenasheva@gmail.com>
        Date:   Tue Oct 4 13:56:31 2016 +0200
        
            Update Jenkinsfile
        

      Please see the attached screenshots.

        1. Changes.png
          Changes.png
          127 kB
        2. Changes in Blue Ocean.png
          Changes in Blue Ocean.png
          37 kB
        3. GitHub-Org-Folders.png
          GitHub-Org-Folders.png
          52 kB
        4. Pipeline-Multi-Branch.png
          Pipeline-Multi-Branch.png
          78 kB

          [JENKINS-38698] SCM Changelog: Commits, made via github, displayed with "noreply" user

          Szymon J added a comment - - edited

          I can't find that setting in the "Git plugin" section in the /configure page. I only see "user.name", "user.email", "Create new accounts base on author/committer's email". Could you point to where to find that setting? Also, it'd be useful to see how to do this in a Jenkinsfile pipeline.

           

          Szymon J added a comment - - edited I can't find that setting in the "Git plugin" section in the /configure page. I only see "user.name", "user.email", "Create new accounts base on author/committer's email". Could you point to where to find that setting? Also, it'd be useful to see how to do this in a Jenkinsfile pipeline.  

          Szymon J added a comment -

          It looks like this setting `authorOrCommitter` has been moved back in 2013 to some "Extensions". Where can I find them? Is it a separate plugin?

          Szymon J added a comment - It looks like this setting `authorOrCommitter` has been moved back in 2013 to some "Extensions". Where can I find them? Is it a separate plugin?

          Mark Waite added a comment -

          Your pipeline definition needs to use the more general purpose "checkout" step rather than the "git" step.  You can use the "pipeline syntax" on most pipeline job pages then choose "checkout" from the dropdown and define the git checkout definition, with full support for extensions.,

          Mark Waite added a comment - Your pipeline definition needs to use the more general purpose "checkout" step rather than the "git" step.  You can use the "pipeline syntax" on most pipeline job pages then choose "checkout" from the dropdown and define the git checkout definition, with full support for extensions.,

          Szymon J added a comment -

          I am already using the "checkout" syntax:

          checkout([$class: 'GitSCM',
            branches: [[name: 'snip']],
            browser: [$class: 'GithubWeb', repoUrl: 'snip'],
            doGenerateSubmoduleConfigurations: false,
            extensions: [],
            submoduleCfg: [],
            userRemoteConfigs: [[snip]])

           

          Where can I find the documentation for the available options?

          Szymon J added a comment - I am already using the "checkout" syntax: checkout([$class: 'GitSCM',   branches: [ [name: 'snip'] ],   browser: [$class: 'GithubWeb', repoUrl: 'snip'] ,   doGenerateSubmoduleConfigurations: false,   extensions: [],   submoduleCfg: [],   userRemoteConfigs: [ [snip] ])   Where can I find the documentation for the available options?

          Szymon J added a comment -

          Now I see that I can choose "Use commit author in changelog" under Additional Behaviour. Thanks!

          Szymon J added a comment - Now I see that I can choose "Use commit author in changelog" under Additional Behaviour. Thanks!

          Roch Devost added a comment - - edited

          Where exactly is this option? I have looked everywhere and cannot seem to find it.

          I am using the `checkout scm` step in Blue Ocean rc3 if that helps.

          Roch Devost added a comment - - edited Where exactly is this option? I have looked everywhere and cannot seem to find it. I am using the `checkout scm` step in Blue Ocean rc3 if that helps.

          Mark Waite added a comment -

          The "pipeline syntax" link on most pipeline job definition pages will let you choose the "checkout" step. That will then guide you through the web page to select various git plugin options. Look for "Additional Behaviours" and you'll find a drop-down list which includes "Use commit author in changelog".

          We were tempted some years ago to make "Use commit author in changelog" the default, but any change to default behavior tends to result in a loud outcry from users who don't expect defaults to change from one release to the next.

          Mark Waite added a comment - The "pipeline syntax" link on most pipeline job definition pages will let you choose the "checkout" step. That will then guide you through the web page to select various git plugin options. Look for "Additional Behaviours" and you'll find a drop-down list which includes "Use commit author in changelog". We were tempted some years ago to make "Use commit author in changelog" the default, but any change to default behavior tends to result in a loud outcry from users who don't expect defaults to change from one release to the next.

          Roch Devost added a comment -

          According to this article: https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch the "Additional Behaviours" should appear in Branch Source -> Git, but in branch source I only have GitHub available, which doesn't have this option.

          Additionally, I want to change the behaviour for all projects if possible and not have to redo this setup on each one (especially since they are created automatically from pushes to the organizations repos).

          I understand the need for backward compatibility, but since pretty much all commits in GitHub are made by "noreply", there should at least be a way to change the behaviour globally (JAVA_OPTS?)

          Roch Devost added a comment - According to this article: https://support.cloudbees.com/hc/en-us/articles/226122247-How-to-Customize-Checkout-for-Pipeline-Multibranch  the "Additional Behaviours" should appear in Branch Source -> Git, but in branch source I only have GitHub available, which doesn't have this option. Additionally, I want to change the behaviour for all projects if possible and not have to redo this setup on each one (especially since they are created automatically from pushes to the organizations repos). I understand the need for backward compatibility, but since pretty much all commits in GitHub are made by "noreply", there should at least be a way to change the behaviour globally (JAVA_OPTS?)

          Mark Waite added a comment -

          I'm not clear which type of pipeline job you're using, since you say that GitHub is the only branch source available.

          If you're using a GitHub Organization Folders job, then the customization of checkout technique will need to be performed either in a pipeline global library shared with all jobs, or in each job.

          If you're using a pipeline multi-branch job, then the customization of checkout technique can be performed at job definition, and may then be adjusted or modified in either a pipeline global library shared with all jobs, or in the Jenkinsfile for each branch.

          Mark Waite added a comment - I'm not clear which type of pipeline job you're using, since you say that GitHub is the only branch source available. If you're using a GitHub Organization Folders job, then the customization of checkout technique will need to be performed either in a pipeline global library shared with all jobs, or in each job. If you're using a pipeline multi-branch job, then the customization of checkout technique can be performed at job definition, and may then be adjusted or modified in either a pipeline global library shared with all jobs, or in the Jenkinsfile for each branch.

          Roch Devost added a comment -

          Since I am using pipeline multi-branch jobs with GitHub, I will add a helper to our shared libraries as you suggested. Thank you very much for your help!

          (I still think however that there should be a way to globally override the default checkout behaviour since it is incompatible with the largest Git provider on the planet)

          Roch Devost added a comment - Since I am using pipeline multi-branch jobs with GitHub, I will add a helper to our shared libraries as you suggested. Thank you very much for your help! (I still think however that there should be a way to globally override the default checkout behaviour since it is incompatible with the largest Git provider on the planet)

            Unassigned Unassigned
            ks_nenasheva Kseniia Nenasheva
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: