-
Bug
-
Resolution: Unresolved
-
Minor
-
None
I'm trying to use the API to get to Freestyle jobs from a Pipeline job. There are various things I need to do but, as a first step, I've just been trying to retrieve a job or list of jobs. Nothing works. I've tried everything suggested here: https://stackoverflow.com/questions/47940699/get-all-pipeline-jobs-in-jenkins-groovy-script and elsewhere. The code runs from the system console but nothing will run from a Pipeline job e.g.
for(job in Jenkins.instance.getAllItems(hudson.model.Job)) {
println job.fullName
}
No problem in the console but...
[Pipeline] node Running on master in /var/lib/jenkins/workspace/ghs1test@9 [Pipeline] End of Pipeline java.lang.NoClassDefFoundError: Could not initialize class sun.nio.fs.UnixCopyFile at sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:262) at java.nio.file.Files.move(Files.java:1395) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:463) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:434) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:422) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:362) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:242) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:230) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112) 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) Finished: FAILURE
in a pipeline. I've tried importing everything I can think of. There are no script approvals shown. Sandbox on or off makes no difference. How can I do things like this in a pipeline, these days?