Gitlab-plugin: Gitlab Upgrade Broke User Email

Created on 4 Feb 2019  路  5Comments  路  Source: jenkinsci/gitlab-plugin

Issue

Upgrading Gitlab from 11.7.0 -> 11.7.3 broke some of our jobs. Specifically, $gitlabUserEmail isn't being set anymore

Context

  • Gitlab plugin version:
  • Gitlab version: 11.7.3
  • Jenkins version: 2.150.2
  • Job type: Pipeline

Logs & Traces

It looks like the failure is because the user_email in the json payload from gitlab is an empty string.

Also, this problem doesn't occur when using the test button from gitlab.

Problem description

The gitlab user email environment variable suddenly disappeared with the 11.7.3 update. This worked on 11.7.0.

echo """
$gitlabBranch
$gitlabSourceBranch
$gitlabActionType
$gitlabUserName
$gitlabUserEmail
$gitlabSourceRepoHomepage
$gitlabSourceRepoName
$gitlabSourceNamespace
$gitlabSourceRepoURL
$gitlabSourceRepoSshUrl
$gitlabSourceRepoHttpUrl
$gitlabBefore
$gitlabAfter
"""

That code is broken on 11.73. I had to remove the $gitlabUserEmail from the echo statement (and nothing else) to get the job to work again.

Most helpful comment

My bad, Public email was in "Do not show on profile". After setting it to my real email I saw gitlabUserEmail with printenv.

All 5 comments

Update: It's because the users on the Gitlab instance I'm on have private emails. See the full details here: https://gitlab.com/gitlab-org/gitlab-ce/issues/57253#note_140080515

So, when a user has a private email, the post value of the user_email is an empty string, which apparently causes the $gitlabUserEmail value to be empty.

I'd love it if the $gitlabUserEmail value stuck around but was just empty when no user_email is sent.

@samsieber I think if we left that value as an empty string, it would break anyone's code that might check for true/false or null or whatever of that value.

I have this problem too, but the "CommitterEmail" variable is still beeing filled by the hook. Could you add an option to use this instead? This would be awesome!

Have the same issue. Current gitlab version is 12.2.5, jenkins - 2.194, gitlab plugin - 1.5.13.
I trigger from gitlab by pressing test a pipeline which simply do printenv.
I see the following vars:
gitlabSourceRepoURL
gitlabAfter
gitlabTargetBranch
gitlabSourceRepoHttpUrl
gitlabMergeRequestLastCommit
gitlabSourceRepoSshUrl
gitlabSourceRepoHomepage
gitlabBranch
gitlabSourceBranch
gitlabBefore
gitlabActionType
gitlabSourceRepoName
gitlabSourceNamespace
gitlabUserName

but there is no gitlabUserEmail at all
Email, Public email and Commit email are filled in user gitlab settings.

My bad, Public email was in "Do not show on profile". After setting it to my real email I saw gitlabUserEmail with printenv.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ffrddrll picture ffrddrll  路  6Comments

asagi687 picture asagi687  路  4Comments

MarcelNehring picture MarcelNehring  路  5Comments

SunBlack picture SunBlack  路  6Comments

almozavr picture almozavr  路  6Comments