Groovy script in Insight automation rules not executed due to not in whitelist, missing file or lack permission

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Common Problems

The automation rule to trigger a Groovy script was triggered as expected but the script wasn't executed.

The following appears in the insight_automation.log.

Scenario 1 - script path is not whitelisted
2021-12-01 15:15:59,576 [insight-event-8] | GroovyScriptAction, got absFilePath: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy
2021-12-01 15:15:59,577 [insight-event-8] | GroovyScriptAction, not in whitelist, exit, absFilePath: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy
Scenario 2 - incorrect script path/script is not found
2021-12-01 15:15:59,576 [insight-event-8] | GroovyScriptAction, got absFilePath: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy
2021-12-01 15:15:59,577 [insight-event-8] | GroovyScriptAction, missing file, absFilePath: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy
Scenario 3 - Script file/folder permission
2021-12-01 15:50:50,076 [insight-event-4] | GroovyScriptAction, got absFilePath: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy
2021-12-01 15:50:50,078 [insight-event-4] | Execute groovy script: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy
2021-12-01 15:50:50,222 [insight-event-4] | AutomationRuleGroovyScriptAction, Unexpected error: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy can not be read. Check the read permission of the file "/Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy" (/Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy).
java.lang.RuntimeException: /Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy can not be read. Check the read permission of the file "/Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy" (/Users/jira/jira-home/atlassian-jira-servicedesk-4.20.0/scripts/Move Object to Archive.groovy).
	at groovy.lang.GroovyCodeSource.<init>(GroovyCodeSource.java:118)
	at groovy.lang.GroovyShell.evaluate(GroovyShell.java:621)
	at com.riadalabs.jira.plugins.insight.services.core.impl.GroovyServiceImpl.evaluate(GroovyServiceImpl.java:86)
	at com.riadalabs.jira.plugins.insight.services.automation.action.AutomationRuleGroovyScriptAction.doActionSafe(AutomationRuleGroovyScriptAction.java:99)
	at com.riadalabs.jira.plugins.insight.services.automation.action.AbstractInsightAutomationAction.doAction(AbstractInsightAutomationAction.java:107)
	at com.riadalabs.jira.plugins.insight.services.automation.rule.impl.AutomationRuleEngineImpl.executeAction(AutomationRuleEngineImpl.java:669)
	at com.riadalabs.jira.plugins.insight.services.automation.rule.impl.AutomationRuleEngineImpl.executeActions(AutomationRuleEngineImpl.java:654)
	at com.riadalabs.jira.plugins.insight.services.automation.rule.impl.AutomationRuleEngineImpl.matchConditionAndExecuteActions(AutomationRuleEngineImpl.java:453)
	at com.riadalabs.jira.plugins.insight.services.automation.rule.impl.AutomationRuleEngineImpl.handleScheduledEvent(AutomationRuleEngineImpl.java:351)
	at com.riadalabs.jira.plugins.insight.services.automation.event.AutomationRuleEventListener.onScheduledEvent(AutomationRuleEventListener.java:112)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:87)
	at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:144)
	at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:72)
	at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:34)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

Diagnosis

Environment

  • Any Insight versions

Diagnostic Steps

  • For scenario 1 and 2, the status of the rule will be a green check mark even though the script actually failed to be executed. For scenario 3, the status of the rule will be a red exclamation mark as shown in the screenshot below.

Cause

Scenario 1
The path to the script is not whitelisted
Scenario 2
The path to the script is incorrect
Scenario 3
The script is not readable by all users especially the user running Jira

Resolution

Scenario 1

Each groovy script has to be whitelisted at Administration > Manage apps > Insight Whitelist. The full path to the script must be provided like in the example below.

Scenario 2

Ensure that the full path to the script is provided correctly in the THEN action of the rule

Scenario 3

Ensure that the directory and the subdirectories where the script(s) is are readable by all users and also executable by the user running Jira. If the script(s) is in a folder resides in Jira home, follow How to fix directory permissions in Linux for Jira Server or How to fix directory permissions in Windows for Jira Server to fix all directories at once. An example of the directory and file permissions.

$ ls -al ~/jira-home/atlassian-jira-servicedesk-4.11.0/scripts
total 8
drwxr-x---   3 jira  staff    96 Nov 24 21:47 .
drwxr-xr-x  21 jira  staff   672 Dec  1 15:48 ..
-rw-r--r--   1 jira  staff  2421 Nov 24 21:47 Move Object to Archive.groovy






DescriptionGroovy script in Insight automation rules not executed due to not in whitelist, missing file or lack permission
ProductInsight - Asset Management
Last modified on Dec 1, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.