Skip to content

Check that the branch name follows a simple pattern / Require approval for Jenkins builds on PRs from external contributors #1551

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ this.helper = new JobHelper(this)
helper.runWithNotification {

stage('Configure') {
// We want to make sure that if we are building a PR that the branch name will not require any escaping of symbols in it.
// Otherwise, it may lead to cryptic build errors.
if (helper.scmSource.branch.name && !(helper.scmSource.branch.name ==~ /^[\w\d\/\\_\-\.]+$/)) {
throw new IllegalArgumentException("""
Branch name ${helper.scmSource.branch.name} contains unexpected symbols.
Only characters, digits and -_.\\/ symbols are allowed in the branch name.
Change the branch name and open a new Pull Request.
""")
}

requireApprovalForPullRequest 'hibernate'

this.environments = AlternativeMultiMap.create([
jdk: [
// This should not include every JDK; in particular let's not care too much about EOL'd JDKs like version 9
Expand Down
Loading