On Tue, 25 Aug 2020 at 00:56, Mark Waite <mark.earl.wa...@gmail.com> wrote:
>
>
>
> On Mon, Aug 24, 2020 at 5:29 PM John Patrick <nhoj.patr...@gmail.com> wrote:
>>
>> Might be a question for developers or a bug ticket.
>>
>> I've got a multibranchPipelineJob project which runs a Jenkinsfile. The job 
>> executes as expected apart form one part.
>>
>> If I select "Configure remote name" and change it to "origin1". When I do 
>> "sh 'git remote -v'". I see as expected;
>>
>> [Pipeline] sh +
>> git remote -v
>> origin1 REPO (fetch)
>> origin1 REPO (push)
>> [Pipeline] sh
>>
>> But If I do "Custom user name/e-mail address" and enter say "aName" and 
>> "aem...@example.tld". When I do "sh 'git config --list'". I don't see 
>> user.name or user.email set, I just see;
>>
>> [Pipeline] sh +
>> git config --list
>> core.repositoryformatversion=0
>> core.filemode=true
>> core.bare=false
>> core.logallrefupdates=true
>> remote.origin1.url=REPO
>> remote.origin1.fetch=+refs/heads/*:refs/remotes/origin1/*
>> [Pipeline] sh
>>
>> According to the documentation I should be seeing user.name and user.email 
>> set here. Just wondering if it's a bug, a bug with multibranch pipeline job, 
>> or I'm missing a step in my Jenkinsfile.
>>
>
> It is a bug in the documentation.  The documentation say one thing (sets 
> config) while the code does something better (sets the environment variable 
> GIT_COMMITTER_NAME and GIT_AUTHOR_NAME).  Documentation fix was merged today 
> and should be visible within the next 24 hours at 
> https://plugins.jenkins.io/git/#custom-user-name-e-mail-address
>

Thanks for the reply, I can see the documentation talking about
GIT_COMMITTER_NAME and GIT_AUTHOR_NAME. Might seem a silly question
but how should I be accessing these environment variables from a
Jenkinsfile?

As I can echo BUILD_ID but not GIT_COMMITTER_NAME, e.g.

sh ' echo "BUILD_ID=${BUILD_ID}"'

give me;
[Pipeline] sh
+ echo BUILD_ID=22
BUILD_ID=22

but;
sh ' echo "GIT_COMMITTER_NAME=${GIT_COMMITTER_NAME}"'

give me;
[Pipeline] sh (hide)
+ echo GIT_COMMITTER_NAME=
GIT_COMMITTER_NAME=

I've tried ${env.GIT_COMMITTER_NAME} but that give "bad substitution"

I've tried;
sh ' echo "GIT_COMMITTER_NAME="' + GIT_COMMITTER_NAME

But that gives;
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property:
GIT_COMMITTER_NAME for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)

Do I have to wait for another jenkins release as your reply implied I
didn't as it was just a documentation issue and I was using the
wrong...

Or am I simply using the wrong syntax to access these environment
variables or missed some setup for the Jenkinsfile.

cheers,
John

>
> Mark Waite
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGUPhbQd0O%3D%2B9TYU-Vy5jr7QqquMQWu2vorgX15MG8kjw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAH9u10ks38FQx%2BA2gXD-8sC84n78MOtLG-Lz-GrCK8CYb6h5ow%40mail.gmail.com.

Reply via email to