From 3d8393f305e350edf2bbf042865451a2c441963e Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Thu, 16 Jan 2025 19:01:09 +0100 Subject: [PATCH 1/2] Check that the branch name follows a simple pattern --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index a1e0dabebd..7ce8aeaa28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -96,6 +96,16 @@ 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. + """) + } + 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 From 12407a32d21342c8f9b901fa339fc826e85e5fb4 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Thu, 16 Jan 2025 19:02:06 +0100 Subject: [PATCH 2/2] Require approval for Jenkins builds on PRs from external contributors --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 7ce8aeaa28..db4523f169 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -106,6 +106,8 @@ stage('Configure') { """) } + 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