-
Bug
-
Resolution: Not A Defect
-
Major
-
None
-
Master: Atomic CentOS
Slave: Windows Server 2012 R2 x64
I have a class in a pipeline shared library (which is stored in a deployed Github repository):
package com.xxx class ArtifactoryPublisher implements Serializable { def script def host ArtifactoryPublisher(script, host) { this.script = script this.host = host } def push(feed, pattern = "*.nupkg") { def artifactory = Artifactory.server this.host def uploadSpec = """{ "files": [ { "pattern": "$pattern", "target": "$feed" } ] }""" def buildInfo = artifactory.upload(uploadSpec) artifactory.publishBuildInfo(buildInfo) } }
When I try to instantiate this in a Jenkinsfile:
def apub = new ArtifactoryPublisher('art01')
I get this:
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified new com.xxx.ArtifactoryPublisher java.lang.String at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:126) at org.kohsuke.groovy.sandbox.impl.Checker$3.call(Checker.java:191) at org.kohsuke.groovy.sandbox.impl.Checker.checkedConstructor(Checker.java:188) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.constructorCall(SandboxInvoker.java:20) at WorkflowScript.run(WorkflowScript:78)
However, it does not show up as a pending script approval.
PS it is possible to create other objects from shared libraries, e.g.
def slack = new Slack(this, mySlack.team, mySlack.channel)
Mismatch in constructor argument count.