bmustiata / jenny

Command line Jenkinsfile runner written in groovy. Does not need a Jenkins installation to run the Jenkinsfile.
BSD 3-Clause "New" or "Revised" License
91 stars 8 forks source link

Is import supported? #59

Closed pbuckley4192 closed 5 years ago

pbuckley4192 commented 5 years ago

Got this error trying to run a basic declarative pipeline.. I have to do an import to get the test results for a nonCPS method...

Is this supported?

/Jenkinsfile: 1: unable to resolve class hudson.tasks.test.AbstractTestResultAction
 @ line 1, column 1.
   import hudson.tasks.test.AbstractTestResultAction
   ^

1 error
ctran commented 5 years ago

I don't think so since that's Jenkins api. You would want to hide than in a library and mock it out locally.

bmustiata commented 5 years ago

I would need to see some small sample.

If it's something that is reusable and would be a good idea to have it in the core, maybe yes. There is only one exception currently, and that's an exception https://github.com/bmustiata/jenny/blob/master/mocks/hudson/AbortException.groovy that jenny would never throw anyway. As you can see this means coding them by hand. Coding them by hand != fun.

If creating custom actions is needed, it seems it would be a good idea to have it there, but it would also mean there is probably also required some wiring that can bring the custom actions into the jenny global context. (extending classpath, classpath scanning, registering actions)

Since I'm not a big fan of custom java actions - I'm using groovy shared libraries all around, with a lot of custom commands - I won't spend a lot of effort into it, but I'm willing to merge any PR in that direction.

pbuckley4192 commented 5 years ago

Ok, Thank you both so much!! Closing the issue now that I have my answer. :+1: