Hi.
I have some Groovy scripts that worked just fine in Jenkins 1.x but are
now broken in 2.x. This is actually blocking my update, so I would be
grateful for any suggestions on how to proceed.
I run the script in a post build step.
I already used Permissive Script Security to try and disable additional
security added in Jenkins 2.x (which honestly I don't need as I'm the
only person editing jobs).
It now breaks on this code I think:
```
// load class
def scriptDir = "/var/www/jenkins-groovy-helpers/JenkinsBuildHelper";
def parent = getClass().getClassLoader();
def loader = new GroovyClassLoader(parent);
def buildLogChecker = loader.parseClass(new File(scriptDir,
"BuildLogChecker.groovy")).newInstance();
```
Jenkins 2.x says:
[PostBuildScript] - [INFO] Executing post build scripts.
ERROR: Build step failed with exception
groovy.lang.MissingMethodException: No signature of method:
java.lang.Class.newInstance() is applicable for argument types:
(java.util.LinkedHashMap) values: [[ignoreMode:false, ignoreLevels:[],
maxLevel:error]]
Possible solutions: newInstance(), newInstance(),
newInstance([Ljava.lang.Object;), isInstance(java.lang.Object)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:159)
Can I load a groovy class in some other way? Or maybe I can enable some
standalone/single-user/single-admin mode or something that disables all
this security checks?
As you can imagine `BuildLogChecker` is used to check log, but also
needs access to job description as it sets descriptions based on errors
in the job log (`build.setDescription(...)`). It also sets results:
```
if (!buildLogChecker.firstLogLines.error.isEmpty()) {
build.setResult(Result.FAILURE);
} else if (!buildLogChecker.firstLogLines.warn.isEmpty()) {
build.setResult(Result.UNSTABLE);
}
```
Regards,
Maciej Nux.
--
You received this message because you are subscribed to the Google Groups "Jenkins
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/2a5df42a-b21d-8c9a-987c-602a89b08374%40mol.com.pl.