splunk / splunkforjenkins

19 stars 55 forks source link

Getting an UnapprovedUsageException message in our Jenkins build pipelines #5

Open binbash12 opened 6 years ago

binbash12 commented 6 years ago

We're getting the following message in our build pipelines in Jenkins from the Splunk for Jenkins plugin. We're running Splunk Plugin and Splunk Plugin Extension version 1.6.4, we configure our plugins as code, and the message just started appearing recently. The Jenkins version we experienced this on is 2.107.2.

org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedUsageException: script not yet approved for use at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval.using(ScriptApproval.java:466) at org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval$using$0.call(Unknown Source) at com.splunk.splunkjenkins.UserActionDSL.perform(UserActionDSL.groovy:41) at com.splunk.splunkjenkins.listeners.LoggingRunListener.onCompleted(LoggingRunListener.java:85) at hudson.model.listeners.RunListener.fireCompleted(RunListener.java:211) at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:730) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1200(WorkflowRun.java:142) at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1065) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1413) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:412) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:35) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

The stack trace points to the exception being thrown from here: https://github.com/splunk/splunkforjenkins/blob/bbe4c4f6428d0e1b741c4bcbf1d3cbaf1adef0b8/splunk-devops/src/main/groovy/com/splunk/splunkjenkins/UserActionDSL.groovy#L41

This is the script that we're running:

"""//send job metadata and junit reports with page size set to 50 (each event contains max 50 test cases) splunkins.sendTestReport(50) //send coverage, each event contains max 50 class metrics splunkins.sendCoverageReport(50) //send all logs from workspace to splunk, with each file size limits to 10MB splunkins.archive("*/.log", null, false, "10MB")

//end"""

It's not showing up in the approve scripts menu, so we aren't sure what to whitelist.

Please let us know if you need any additional information.

Best regards, Matt

binbash12 commented 6 years ago

Just to note, this is not affecting the outcome of our build pipelines whatsoever, at this point it would appear just a strange but cosmetic exception bug.

fengxx commented 5 years ago

If the script does not show up in /scriptApproval/, could you please try goto /configure and click save, then check the scriptApproval list. Normally script security was checked when user configure the plugin, there maybe a glitch in migration settings from older version than 1.5.3