Added option to reuse GitSCM's excluded users list#222
Open
pbalint wants to merge 3 commits intojenkinsci:masterfrom
Open
Added option to reuse GitSCM's excluded users list#222pbalint wants to merge 3 commits intojenkinsci:masterfrom
pbalint wants to merge 3 commits intojenkinsci:masterfrom
Conversation
Author
|
@KostyaSha , @lanwen May I get a review, please? |
KostyaSha
reviewed
Dec 10, 2019
| } | ||
| } | ||
|
|
||
| if (excludedUsers != null && excludedUsers.contains(event.getTriggeredByUser())) { |
Author
There was a problem hiding this comment.
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...
Member
There was a problem hiding this comment.
gitscm extension is for git users, github users case insensitive you do comparison in terms of GH functionality it should be ignorecase
Author
|
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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