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

GIT: UserIdentity does not work on pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None
    • Linux, primary checkout in normal node, work done in docker (docker.image.inside...)

      A pipeline job with checkout configured as :

       

      checkout ([poll: false,
      scm: [$class: 'GitSCM',
      branches: [[name: '$GERRIT_BRANCH']],
      doGenerateSubmoduleConfigurations: false,
      extensions: [[$class: 'WipeWorkspace'],
      [$class: 'BuildChooserSetting',
      buildChooser: [$class: 'GerritTriggerBuildChooser']],
      [$class: 'UserIdentity',
      email: 'jenkins@<domain>',
      name: 'Jenkins (NICOS release job)']
      ],
      gitTool: 'Default',
      submoduleCfg: [],
      userRemoteConfigs: [[credentialsId: 'XXXXX',
      refspec: '$GERRIT_REFSPEC',
      url: 'ssh://<host>/$GERRIT_PROJECT']]
      ]
      ]
      

      give the  following log output:

       [Pipeline] checkout
      Wiping out workspace first.
      Cloning the remote Git repository
      Cloning repository ssh://<host>/<project>
       > /usr/bin/git init /home/jenkins/jobs/XXXX/workspace # timeout=10
      Fetching upstream changes from ssh://<host>/<project>
       > /usr/bin/git --version # timeout=10
      using GIT_SSH to set credentials XXXXX
       > /usr/bin/git fetch --tags --progress ssh://<host>/<project> +refs/heads/*:refs/remotes/origin/*
       > /usr/bin/git config remote.origin.url ssh://<host>/<project> # timeout=10
       > /usr/bin/git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
       > /usr/bin/git config remote.origin.url ssh://<host>/<project> # timeout=10
      Fetching upstream changes from ssh://<host>/<project>
      using GIT_SSH to set credentials XXXXXXXXXX
       > /usr/bin/git fetch --tags --progress ssh://<host>/<project> refs/heads/release-3.0
       > /usr/bin/git rev-parse FETCH_HEAD^{commit} # timeout=10
      Checking out Revision eb56ef5e23cebf5ba496421b32fcd650c503402d ($GERRIT_BRANCH)
      Commit message: "simulation: do not emit warning if quiet"
       > /usr/bin/git config core.sparsecheckout # timeout=10
       > /usr/bin/git checkout -f eb56ef5e23cebf5ba496421b32fcd650c503402d
       > /usr/bin/git rev-parse FETCH_HEAD^{commit} # timeout=10
       > /usr/bin/git rev-list cef586346270967a0435d76501053395197cf6a5 # timeout=10
      [Pipeline] }
      
      

      As you can see, the user.name/email are never set.

      With docker.image.inside, this results in the following error later on:

      *** Please tell me who you are.
      
      Run
      
        git config --global user.email "you@example.com"
        git config --global user.name "Your Name"
      
      to set your account's default identity.
      Omit --global to set the identity only in this repository.
      
      fatal: empty ident name (for <jenkins@67b4ac9c6b46.(none)>) not allowed
      

      Workaround: Add a sh step to configure the repo

                      sh '''
                      git config user.email "jenkins@<domain>"
                      git config user.name "Jenkins (NICOS release job)"
                      '''
      
      

       

            Unassigned Unassigned
            pedersen Björn Pedersen
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: