-
Notifications
You must be signed in to change notification settings - Fork 105
Added environment variables for MR comment event #127
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
Added environment variables for MR comment event #127
Conversation
2683d9a to
e618502
Compare
boggard
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, mate!
|
@eugenelesnov Thanks! Your solution lgtm ! |
|
@MikeSafonov good 😎 |
LinuxSuRen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I left some comments. Please take a look at it.
| * @param commentUrl the URL for the GitLab comment | ||
| */ | ||
| public GitLabMergeRequestCommentCause(String commentUrl) { | ||
| public GitLabMergeRequestCommentCause(String commentUrl, NoteEvent noteEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to add a new constructor instead of changing the existing one. Because you cannot sure there are no others who might need that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, sir
| this.variables.put("GITLAB_REPO_VISIBILITY_LEVEL", defaultVisibilityString(noteEvent.getRepository().getVisibility_level())); | ||
| this.variables.put("GITLAB_REQUEST_URL", defaultString(noteEvent.getRequestUrl())); | ||
| this.variables.put("GITLAB_REQUEST_STRING", defaultString(noteEvent.getRequestQueryString())); | ||
| this.variables.put("GITLAB_REQUEST_TOKEN", defaultString(noteEvent.getRequestSecretToken())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's safe here.
| this.variables.put("GITLAB_COMMENT_TRIGGER", defaultString(noteEvent.getObjectAttributes().getNote())); | ||
| this.variables.put("GITLAB_USER_ID", defaultIntString(noteEvent.getUser().getId())); | ||
| this.variables.put("GITLAB_PROJECT_ID", defaultIntString(noteEvent.getProjectId())); | ||
| this.variables.put("GITLAB_PROJECT_ID_2", defaultIntString(noteEvent.getProject().getId())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between GITLAB_PROJECT_ID and GITLAB_PROJECT_ID_2?
|
|
||
| private final Map<String, String> variables = new HashMap<>(); | ||
|
|
||
| public GitLabMergeRequestNoteData(NoteEvent noteEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great to have some useful environment variables. But I have two questions about it.
- How users can know the variable name and its meaning
- Do we need so many variables? Or they're all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering all comments above here. Most of variables were copied from another classes from io.jenkins.plugins.gitlabbranchsource.Cause package. My bad, meh.
For sure, GITLAB_COMMENT_TRIGGER is enough..
e618502 to
579411f
Compare
579411f to
e2a9688
Compare
LinuxSuRen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Let's wait for some potential comments from other reviewers.
resolves #123
also relevant to JENKINS-60282
Added environment variables to access NoteEvent (comment on MR) data.