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

Git plugin does not set user in pipeline

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: git-plugin
    • Labels:
      None
    • Similar Issues:

      Description

      It's been noted in other issues (JENKINS-35230) that the Git plugin does not export its environment variables when used with a pipeline job. In addition, the plugin does not set user.name and user.email, as it does in traditional jobs, meaning that any attempts to commit to the repository from within a pipeline fail with "tell me who you are".

      It would be useful to have the environment variables available, but even without them, the plugin should be able to set the Git config as it performs checkout.

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          The documentation

          It's sourced from a wiki page linked in the sidebar, everyone with an account can edit it. Users frequently contribute to that, and the changes are of varying quality. I'm sure Mark would appreciate your help in improving the quality of the documentation.

          Show
          danielbeck Daniel Beck added a comment - The documentation It's sourced from a wiki page linked in the sidebar, everyone with an account can edit it. Users frequently contribute to that, and the changes are of varying quality. I'm sure Mark would appreciate your help in improving the quality of the documentation.
          Hide
          markewaite Mark Waite added a comment -

          Michael Düsterhus I'm happy to receive a pull request with automated tests that show the problem and a code change that fixes the tests. Thanks for your interest in helping the Jenkins project!

          Show
          markewaite Mark Waite added a comment - Michael Düsterhus I'm happy to receive a pull request with automated tests that show the problem and a code change that fixes the tests. Thanks for your interest in helping the Jenkins project!
          Hide
          apr_1985 Adam Roberts added a comment -

          I have added a Warning on the https://wiki.jenkins.io/display/JENKINS/Git+Plugin page as I too wasted time trying to debug this issue.

          Show
          apr_1985 Adam Roberts added a comment - I have added a Warning on the https://wiki.jenkins.io/display/JENKINS/Git+Plugin page as I too wasted time trying to debug this issue.
          Hide
          mwyraz Michael michael@wyraz.de added a comment -

          Is it possible to access these settings programmatically in the pipeline?

          Show
          mwyraz Michael michael@wyraz.de added a comment - Is it possible to access these settings programmatically in the pipeline?
          Hide
          mwyraz Michael michael@wyraz.de added a comment - - edited

          Update: it is possible through the scm variable. So my workaround is:

          					def scmvars=steps.checkout(globals.scm)
          					if (scmvars.GIT_AUTHOR_NAME && scmvars.GIT_AUTHOR_EMAIL) {
          						steps.sh(script:"""
          							git config user.name '${scmvars.GIT_AUTHOR_NAME}'
          							git config user.email '${scmvars.GIT_AUTHOR_EMAIL}'
          							""")
          					}
          
          Show
          mwyraz Michael michael@wyraz.de added a comment - - edited Update: it is possible through the scm variable. So my workaround is: def scmvars=steps.checkout(globals.scm) if (scmvars.GIT_AUTHOR_NAME && scmvars.GIT_AUTHOR_EMAIL) { steps.sh(script:""" git config user.name '${scmvars.GIT_AUTHOR_NAME}' git config user.email '${scmvars.GIT_AUTHOR_EMAIL}' """) }

            People

            • Assignee:
              Unassigned
              Reporter:
              chrylis Christopher Smith
            • Votes:
              8 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated: