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

GIT_COMMITTER_[NAME || EMAIL] appear to be getting incorrect values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • None
    • Jenkins 1.537, Jenkins GIT plugin 2.0, Jenkins GIT client plugin 1.4.6, Windows Server 2012 Standard, msysgit 1.8.4

      I have configured a Jenkins job to send an email when certain files, defined by Include Regions for a specified branch, are modified. The job has one "Windows Powershell" build step that creates the email and sends it. The script utilizes the GIT_COMMIT, GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables to indicate the name and email of the person who created the commit that triggered the job to fire. However the resulting email is showing the name and email configured as the "Global Config user.name" and "Global config user.email" values in the Jenkins server configuration page rather than the name and email of the user for the GIT_COMMIT that is displayed.

      The Jenkins Git name and email config values were never used in any of the commits that may have triggered the job.

      The following is the powershell script entered into the build step:

      Write-Host (""*30) Sending Email (""*30)

      $smtpServer = "127.0.0.1"
      $msg = new-object Net.Mail.MailMessage
      $smtp = new-object Net.Mail.SmtpClient($smtpServer)

      $msg.From = "Buildmaster <buildmaster@company.com>"
      $msg.ReplyTo = "buildmaster@company.com"
      $msg.To.Add("me@company.com")
      $msg.subject = "Product Style Modification"
      $msg.body = "The Product style definition in the development branch has been modified by:"
      $msg.body = $msg.body + "`n`tName:`t`t$env:GIT_COMMITTER_NAME"
      $msg.body = $msg.body + "`n`tEmail:`t`t$env:GIT_COMMITTER_EMAIL"
      $msg.body = $msg.body + "`n`tCommit:`t$env:GIT_COMMIT"
      $msg.body = $msg.body + "`n`n$($env:BUILD_URL)changes#detail"
      $smtp
      $smtp.Send($msg)

      exit 0

            ndeloof Nicolas De Loof
            mlong072 Mike Long
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: