-
Notifications
You must be signed in to change notification settings - Fork 399
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 option to reuse GitSCM's excluded users list #222
base: master
Are you sure you want to change the base?
Conversation
@KostyaSha , @lanwen May I get a review, please? |
} | ||
} | ||
|
||
if (excludedUsers != null && excludedUsers.contains(event.getTriggeredByUser())) { |
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.
Should be ignorecase
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 appears to me the SCM polling is case sensitive as well:
https://github.com/jenkinsci/git-plugin/blob/a7ad6eb38a00397c4a656b53d99bfbad8ea3b2cc/src/main/java/hudson/plugins/git/extensions/impl/UserExclusion.java#L63
So if the webhooks push trigger checks the exclusion list in a case insensitive manner, there will be a counter-intuitive difference...
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.
gitscm extension is for git users, github users case insensitive you do comparison in terms of GH functionality it should be ignorecase
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.
Done
Ok, I've updated the PR and changed it to be case insensitive...
…On Tue, Dec 17, 2019 at 7:26 PM Kanstantsin Shautsou < ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java
<#222 (comment)>
:
> @@ -98,6 +104,22 @@ public void onPost(final GitHubTriggerEvent event) {
if (Objects.isNull(job)) {
return; // nothing to do
}
+ if (useGitExcludedUsers) {
+ Set<String> excludedUsers = null;
+ if (job instanceof AbstractProject) {
+ SCM scm = ((AbstractProject<?, ?>) job).getScm();
+ if (scm instanceof GitSCM) {
+ UserExclusion exclusions = ((GitSCM) scm).getExtensions().get(UserExclusion.class);
+ if (exclusions != null) {
+ excludedUsers = exclusions.getExcludedUsersNormalized();
+ }
+ }
+ }
+
+ if (excludedUsers != null && excludedUsers.contains(event.getTriggeredByUser())) {
gitscm extension is for git users, github users case insensitive you do
comparison in terms of GH functionality it should be ignorecase
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#222?email_source=notifications&email_token=ABECHSXCRWRN74ZDF7RJJRLQZEKW7A5CNFSM4JOGT3JKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCPQJQ4Y#discussion_r358955220>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABECHSS4477PWB2VJMLJMG3QZEKW7ANCNFSM4JOGT3JA>
.
|
Added an extra test case for the case insensitive scenario
91a48f2
to
64c55d5
Compare
This change enables the github plugin to respect GitSCM's excluded user list (which is used when polling) for github webhooks:
This is a first attempt to solve the issue of having the maven release plugin increase artifact versions generate an infinite build loop when combined with git webhooks...
This change is