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 loose forbidden file #339
Fix loose forbidden file #339
Conversation
@@ -219,29 +220,22 @@ public boolean isInteresting(String project, String branch, String topic, List<S | |||
boolean foundInterestingTopicOrFile = false; |
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 don't think these are used any more?
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
return true; | ||
} | ||
} | ||
return isInterestingTopic(topic) && !files.isEmpty() && isInterestingFile(files); |
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 we want to return false
if there are no changed files. Only if there are files we are interested in and changed files is empty.
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.
The condition you indicate is handled in isInterestingFile().
This test is here because we should return false
when all files are forbidden, i.e. there are no more after filtering.
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
When `disableStrictForbiddenFileVerification` is set and the commit contains only forbidden files, the build should not be triggered. This can happen when setting forbidden files but not allowed files, i.e. marking all files as interesting.
43f85dc
to
6b6af61
Compare
@rsandell : I have updated the patch, can you check it again? Thanks, |
return false; | ||
} else { | ||
foundInterestingForbidden = true; | ||
i.remove(); |
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.
Potentially this line creates a bug. Because https://github.com/sonyxperiadev/gerrit-events/blob/7f3547c6d55946e25e99a847b5160d69e59994ba/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/ChangeBasedEvent.java caches the list of files and checks it against null. So, one trigger modifies list of files visible for another trigger.
When
disableStrictForbiddenFileVerification
is set and thecontains only forbidden files, the build should not be triggered. This
can happen when setting forbidden files but not allowed files, i.e.
marking all files as interesting.