Skip to content
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

Merged
merged 2 commits into from Dec 18, 2017

Conversation

francoisferrand
Copy link
Contributor

When disableStrictForbiddenFileVerification is set and the
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.

@@ -219,29 +220,22 @@ public boolean isInteresting(String project, String branch, String topic, List<S
boolean foundInterestingTopicOrFile = false;
Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.
@francoisferrand
Copy link
Contributor Author

@rsandell : I have updated the patch, can you check it again? Thanks,

@rsandell rsandell merged commit 13fa586 into jenkinsci:master Dec 18, 2017
@francoisferrand francoisferrand deleted the fixLooseForbiddenFile branch December 21, 2017 08:21
return false;
} else {
foundInterestingForbidden = true;
i.remove();
Copy link
Contributor

@Jimilian Jimilian Jan 15, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants