-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix "FATAL: Null value not allowed as an environment variable: gitlabUserEmail" #170
Conversation
…ab will not return us the email address of the author: curl http://hust/api/v3/projects/1/merge_requests?state=opened\&private_token=CiQcZ9TLJ3qZD6sy-Ftv [{"id":6,"iid":6,"project_id":1,"title":"mr3.1","description":"mr3.1", ... "author":{ "name":"luo.runbing", "username":"luo.runbing", "id":2, "state":"active", "avatar_url":"http://www.gravatar.com/avatar/3c0c2978976bf9b11c965017aec497a9?s=80\u0026d=identicon", "web_url":"http://hust/u/luo.runbing"}, ...}] which results error like this: FATAL: Null value not allowed as an environment variable: gitlabUserEmail Signed-off-by: runsisi <[email protected]>
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
I can verify this PR is need and works. |
The null check should be move to the location where the getters getName and getEmail of the author are accessed. This change will cause that also the environment variable gitlabUserName isn't set although just the email of the author is null. |
I agree with coder-hugo's comment. diff --git a/src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java b/src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java
index 1ef50ad..3a27ace 100644
--- a/src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java
+++ b/src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java
@@ -396,7 +396,10 @@
values.put("gitlabActionType", new StringParameterValue("gitlabActionType", "MERGE"));
if (req.getObjectAttribute().getAuthor() != null) {
values.put("gitlabUserName", new StringParameterValue("gitlabUserName", req.getObjectAttribute().getAuthor().getName()));
- values.put("gitlabUserEmail", new StringParameterValue("gitlabUserEmail", req.getObjectAttribute().getAuthor().getEmail()));
+ String email = req.getObjectAttribute().getAuthor().getEmail();
+ if (email!=null) {
+ values.put("gitlabUserEmail", new StringParameterValue("gitlabUserEmail", email));
+ }
}
values.put("gitlabMergeRequestTitle", new StringParameterValue("gitlabMergeRequestTitle", req.getObjectAttribute().getTitle()));
values.put("gitlabMergeRequestId", new StringParameterValue("gitlabMergeRequestId", req.getObjectAttribute().getIid().toString())); |
So... any eta on this making it's way downstream? I got people heavily invested and depending on a jenkins-gitlab pipeline, and this is sorta...well...breaking us. |
We're also needing this. Is there any chance this can get merged soon? |
@WonderCsabo can you respond to @coder-hugo's comment? I think that's what we're waiting on. |
@omehegan i am a little bit confused now. I did not get any comment from @coder-hugo . If you are referring to #170 (comment), my reimplementation of this PR (#216), was already created with that comment in mind, actually my PR is the same as this #170 (comment) snippet. |
@WonderCsabo, so the way to go would be to: |
Exactly. |
@WonderCsabo sorry, you're right, the original comment was for @runsisi. But it sounds like we should reject this in favor of PR #216. @coder-hugo agree? |
as in gitlab-ce-8.3.0-ce, when we try to get info of opened MRs, gitlab will not return us the email address of the author:
which results error like this:
Signed-off-by: runsisi [email protected]