Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,991
Community Members
 
Community Events
184
Community Groups

MergeChecks script error

We have the MergeChecks script in BitBucket and it has been working; however, after upgraded ScriptRunner to version 8.1.0, the script is broken and gave error:

# Script: get the merge from branch value and to branch value, split it by / and get the second value after splitted.  compare them and if the values are the same, allow the merge.

# e.g. toBranch = develop/asc  and fromBranch = feature/asc/<Jira-issue>

def toBranch = mergeRequest.pullRequest.toRef.displayId
def fromBranch = mergeRequest.pullRequest.fromRef.displayId

def str1;
def str2;

str1 = toBranch.split('/')[1];
str2 = fromBranch.split('/')[1];

if (str1 == str2) {
    return false;
} else {
    return true;
}
After upgraded ScriptRunner, It gave the following error.  How do we fix it?
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during semantic analysis: Expression [BinaryExpression] is not allowed: toBranch.split(/)[1]

java.lang.SecurityException: Expression [BinaryExpression] is not allowed: toBranch.split(/)[1]
	at org.codehaus.groovy.control.customizers.SecureASTCustomizer$SecuringCodeVisitor.assertExpressionAuthorized(SecureASTCustomizer.java:1084)
	at org.codehaus.groovy.control.customizers.SecureASTCustomizer$SecuringCodeVisitor.visitBinaryExpression(SecureASTCustomizer.java:1300)
	at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:60)
	at org.codehaus.groovy.control.customizers.SecureASTCustomizer$SecuringCodeVisitor.visitBinaryExpression(SecureASTCustomizer.java:1303)
	at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:60)
	at org.codehaus.groovy.control.customizers.SecureASTCustomizer$SecuringCodeVisitor.visitExpressionStatement(SecureASTCustomizer.java:1173)
	at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:41)
	at org.codehaus.groovy.control.customizers.SecureASTCustomizer$SecuringCodeVisitor.visitBlockStatement(SecureASTCustomizer.java:1137)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:70)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events