Calling a DSL extension resulting in error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Calling a DSL extension resulting in error

Rijo Simon
I have a created a DSL plugin as documented at the end of this link: https://jenkins.io/blog/2016/04/21/dsl-plugins/ (Check Making it a plugin).

I however get the following error when I call the DSL command:

org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (org.jenkinsci.plugins.workflow.cps.CpsClosure2 gobuild java.util.LinkedHashMap)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.whitelists.StaticWhitelist.rejectMethod(StaticWhitelist.java:180)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:135)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:120)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
	at dsl.gobuild.RunGoBuild(gobuild.groovy:6)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:103)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:60)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:19)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:35)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:32)
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
	at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:32)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:331)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:243)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:231)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

Any clue as to what issue this stacktrace is pointing out to, or just anyone who has experience with this issue. Their help would be greatly appreciated.

Thanks,
Rijo

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/846eb280-d050-4da5-8b29-d364eb4dcc17%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Victor Martinez
Please ask to the jenkinsci-users mailing list: https://jenkins.io/mailing-lists/

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c60356da-ef68-4202-adc5-3c2023004bbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

stephenconnolly

On Wed 3 Jan 2018 at 08:24, Victor Martinez <[hidden email]> wrote:
Please ask to the jenkinsci-users mailing list: https://jenkins.io/mailing-lists/

The poster is *clearly* asking a question about plugin development.

This is the correct list for that.

The users list is clearly incorrect in that regards

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/c60356da-ef68-4202-adc5-3c2023004bbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from my phone

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMwP%3DR68AgENxRT2E%2BXRnXikOTqOD%3DAzbZjoc8RNm_ccKg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Victor Martinez
Sorry if I misunderstood this question, but I though that particular stacktrace was related to the usage of the script approval process.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b58a38fc-dc97-40d1-8fe1-75349a0c8005%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

stephenconnolly
The "I have a created a DSL plugin" at the start of the mail is the hint I am looking at... now it may be a script approval issue, but that may actually instead point to a question as to how to annotate a newly developed extension to mark the script safe methods... or it may be plain script approval... but we are starting from "I have a created a DSL plugin"

On 3 January 2018 at 09:11, Victor Martinez <[hidden email]> wrote:
Sorry if I misunderstood this question, but I though that particular stacktrace was related to the usage of the script approval process.

Cheers

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/b58a38fc-dc97-40d1-8fe1-75349a0c8005%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CA%2BnPnMx-d7RERG0XAGPXs3AMzPvwDuXBqExi0jt%3DP9UnxAtbDQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Jesse Glick-4
In reply to this post by Rijo Simon
On Tue, Jan 2, 2018 at 11:54 PM, Rijo Simon <[hidden email]> wrote:
> I have a created a DSL plugin as documented at the end of this link:
> https://jenkins.io/blog/2016/04/21/dsl-plugins/ (Check Making it a plugin).

I would strongly advise you not to use the builder pattern
(`Closure.DELEGATE_FIRST` etc.) shown in that blog post and the source
of the error you saw. Use plain function arguments or a `Map`-valued
parameter.

I would also advise you not to package DSLs in plugins. You can use

@Library('github.com/myacct/myrepo') _

to distribute a library directly—in which case this indeed becomes a
users’ list question.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3_TsxcekxeSCRNwM9-scy2dPytPt7bbjYjwwqUkg%2BNuQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
Hey Jesse,

What is the reason you advice to not to package DSLs in plugins? My team here things it is better to package it with the plugin since that would allow easier distribution of the DSL extension across the various Jenkins instances used. What is the negative case to this?

Thanks,
Rijo

On Wednesday, January 3, 2018 at 9:52:09 AM UTC-8, Jesse Glick wrote:
On Tue, Jan 2, 2018 at 11:54 PM, Rijo Simon <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="yBqasbzYEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ri...@...> wrote:
> I have a created a DSL plugin as documented at the end of this link:
> <a href="https://jenkins.io/blog/2016/04/21/dsl-plugins/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fblog%2F2016%2F04%2F21%2Fdsl-plugins%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHYIB2yxudSa5vRXJX3XrjhcVzs0g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fblog%2F2016%2F04%2F21%2Fdsl-plugins%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHYIB2yxudSa5vRXJX3XrjhcVzs0g&#39;;return true;">https://jenkins.io/blog/2016/04/21/dsl-plugins/ (Check Making it a plugin).

I would strongly advise you not to use the builder pattern
(`Closure.DELEGATE_FIRST` etc.) shown in that blog post and the source
of the error you saw. Use plain function arguments or a `Map`-valued
parameter.

I would also advise you not to package DSLs in plugins. You can use

@Library('<a href="http://github.com/myacct/myrepo" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2Fmyacct%2Fmyrepo\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEf--CE9N7-_nhReV3lZ1TeNoiZDw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2Fmyacct%2Fmyrepo\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEf--CE9N7-_nhReV3lZ1TeNoiZDw&#39;;return true;">github.com/myacct/myrepo') _

to distribute a library directly—in which case this indeed becomes a
users’ list question.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/1241b2c1-488d-4260-aaa1-c81266c07934%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
Also I am not using the builder pattern, my groovy files looks like this:

package dsl

def RunGoBuild(Map gobuild_params = [:])
{
   stage ('go-build-stage'){
   gobuild product: "${gobuild_params.product ?: 'copytest64'}", branch: "${gobuild_params.branch ?: 'stage'}", changeset: "${gobuild_params.changeset ?: 'latest'}", buildType: "${gobuild_params.buildType ?: 'beta'}"
   }
}

def RunGoBuildWithLatestChange(Map gobuild_params = [:])
{
 stage ('go-build-stage'){
 gobuild product: "${gobuild_params.product ?: 'copytest64'}", branch: "${gobuild_params.branch ?: 'stage'}", changeset: "latest", buildType: "${gobuild_params.buildType ?: 'beta'}"
 }
}


On Wednesday, January 3, 2018 at 10:10:53 AM UTC-8, Rijo Simon wrote:
Hey Jesse,

What is the reason you advice to not to package DSLs in plugins? My team here things it is better to package it with the plugin since that would allow easier distribution of the DSL extension across the various Jenkins instances used. What is the negative case to this?

Thanks,
Rijo

On Wednesday, January 3, 2018 at 9:52:09 AM UTC-8, Jesse Glick wrote:
On Tue, Jan 2, 2018 at 11:54 PM, Rijo Simon <[hidden email]> wrote:
> I have a created a DSL plugin as documented at the end of this link:
> <a href="https://jenkins.io/blog/2016/04/21/dsl-plugins/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fblog%2F2016%2F04%2F21%2Fdsl-plugins%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHYIB2yxudSa5vRXJX3XrjhcVzs0g&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fblog%2F2016%2F04%2F21%2Fdsl-plugins%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHYIB2yxudSa5vRXJX3XrjhcVzs0g&#39;;return true;">https://jenkins.io/blog/2016/04/21/dsl-plugins/ (Check Making it a plugin).

I would strongly advise you not to use the builder pattern
(`Closure.DELEGATE_FIRST` etc.) shown in that blog post and the source
of the error you saw. Use plain function arguments or a `Map`-valued
parameter.

I would also advise you not to package DSLs in plugins. You can use

@Library('<a href="http://github.com/myacct/myrepo" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2Fmyacct%2Fmyrepo\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEf--CE9N7-_nhReV3lZ1TeNoiZDw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fgithub.com%2Fmyacct%2Fmyrepo\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEf--CE9N7-_nhReV3lZ1TeNoiZDw&#39;;return true;">github.com/myacct/myrepo') _

to distribute a library directly—in which case this indeed becomes a
users’ list question.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/3aa55fd7-a3be-4e2f-ab8b-ce754ea1a545%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Jesse Glick-4
In reply to this post by Rijo Simon
On Wed, Jan 3, 2018 at 1:10 PM, Rijo Simon <[hidden email]> wrote:
> What is the reason you advice to not to package DSLs in plugins?

Because you can already share libraries across instances, much more
easily, and without drawbacks such as forcing a single version of the
library upon every job in a server.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0XxBs0jrfDW8SbgCKrK6WtTZzd1Wj%2BgE9ZUJ8NtdR5mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Jesse Glick-4
In reply to this post by Rijo Simon
On Wed, Jan 3, 2018 at 1:12 PM, Rijo Simon <[hidden email]> wrote:
>    gobuild product: "${gobuild_params.product ?: 'copytest64'}", branch:
> "${gobuild_params.branch ?: 'stage'}", changeset:
> "${gobuild_params.changeset ?: 'latest'}", buildType:
> "${gobuild_params.buildType ?: 'beta'}"

Whatever this `gobuild` method is supposed to be, it is not defined. A
question for the users’ list.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr3chRzQbNAVJMzJyPAC9-ZefbXpZC0KLSSwQAYGR6tUHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
ok so I think I was wrong in using gobuild method within the groovy file, but I still think this issue is relevant to Jenkins developer group.

This plugin I am developing basically calls and maintains some command line instructions that is implemented as a class that extends to Builder and implements SimpleBuildStep. So basically I can use this plugin added as a buildstep in a  freestyle project:


Now I want to extend DSL so that this BuildStep plugin can be called from a pipeline script. Please guide me on how to achieve this.

Thanks,
Rijo

On Wednesday, January 3, 2018 at 10:25:43 AM UTC-8, Jesse Glick wrote:
On Wed, Jan 3, 2018 at 1:12 PM, Rijo Simon <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="hi9pmZHaEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ri...@...> wrote:
>    gobuild product: "${gobuild_params.product ?: 'copytest64'}", branch:
> "${gobuild_params.branch ?: 'stage'}", changeset:
> "${gobuild_params.changeset ?: 'latest'}", buildType:
> "${gobuild_params.buildType ?: 'beta'}"

Whatever this `gobuild` method is supposed to be, it is not defined. A
question for the users’ list.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2f2b184e-4e21-46c3-8fdb-fd5e7af0327c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Daniel Beck

> On 3. Jan 2018, at 22:37, Rijo Simon <[hidden email]> wrote:
>
> so that this BuildStep plugin can be called from a pipeline script. Please guide me on how to achieve this.

https://jenkins.io/doc/developer/plugin-development/pipeline-integration/ should have everything you need.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/9F3C1281-555B-49C2-85E0-B845DE1B1350%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
Hey Daniel, Thanks for pointing it out. Again some of my queries here are based out of nube status developing a jenkins plugin. Or even writing pipeline script. So here it goes.

So I read how ForgetBuilder was defined in the pipeline integration documentation below, and then I first tried what the documentation suggested which is try running the following script: 

step([$class: 'ForgetBuilder', what: 'everything'])

The only difference was that I had more than one argument in my constructor so my pipeline script looked like this: 

step([$class: 'ForgetBuilder', what: 'everything', where: 'anywhere', when: 'anytime'])

This returned "java.lang.NoSuchMethodError: No such DSL method 'step' found among steps" error. Then I edited my script to look like this:

stage{
steps ([$class: 'ForgetBuilder', what: 'everything', where: 'anywhere', when: 'anytime'])
}

Which gives me the following stacktrace:

[Pipeline] stage
[Pipeline] // stage
[Pipeline] End of Pipeline
java.lang.IllegalArgumentException: must specify name
	at org.jenkinsci.plugins.workflow.support.steps.StageStep.<init>(StageStep.java:47)
Caused: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:260)
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:201)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:205)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:19)
Caused: java.lang.IllegalArgumentException: Could not instantiate {} for StageStep(name: String, concurrency?: int)
	at org.jenkinsci.plugins.structs.describable.DescribableModel.instantiate(DescribableModel.java:264)
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.newInstance(StepDescriptor.java:201)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:205)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:19)
	at WorkflowScript.run(WorkflowScript:1)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:331)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:243)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:231)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

What is the illegal argument that it is refering to here? My constructor does have all three argument above defined, so I don't know what it is talking about. I really appreciate your help with this.

Thanks,
Rijo

On Wednesday, January 3, 2018 at 1:59:18 PM UTC-8, Daniel Beck wrote:

> On 3. Jan 2018, at 22:37, Rijo Simon <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="MXzgSDnmEAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ri...@...> wrote:
>
> so that this BuildStep plugin can be called from a pipeline script. Please guide me on how to achieve this.

<a href="https://jenkins.io/doc/developer/plugin-development/pipeline-integration/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fdoc%2Fdeveloper%2Fplugin-development%2Fpipeline-integration%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbG-vapbf3zI9CkUwbVzkOshJpRw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2Fdoc%2Fdeveloper%2Fplugin-development%2Fpipeline-integration%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbG-vapbf3zI9CkUwbVzkOshJpRw&#39;;return true;">https://jenkins.io/doc/developer/plugin-development/pipeline-integration/ should have everything you need.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/2821818b-eedb-462c-b9e4-3a2371f8cf88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Jesse Glick-4
On Fri, Jan 5, 2018 at 2:36 PM, Rijo Simon <[hidden email]> wrote:
> java.lang.NoSuchMethodError: No such DSL method 'step' found among steps

Install the `workflow-basic-steps` plugin.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2W7fEsdrd7P5swyZdZg6Ofyn4afVV9U%2BHdVMOHBj6eTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
After install workflow-basic-steps, I get the following stacktrace:

[Pipeline] stage
[Pipeline] { (gobuild-stage)
[Pipeline] step
Required context class hudson.FilePath is missing
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
org.jenkinsci.plugins.workflow.steps.MissingContextVariableException: Required context class hudson.FilePath is missing
	at org.jenkinsci.plugins.workflow.steps.StepDescriptor.checkContextAvailability(StepDescriptor.java:260)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:203)
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:150)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
	at groovy.lang.MetaClassImpl.invokeMethodOnGroovyObject(MetaClassImpl.java:1278)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1172)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:19)
	at WorkflowScript.run(WorkflowScript:2)
	at ___cps.transform___(Native Method)
	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
	at sun.reflect.GeneratedMethodAccessor368.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
	at sun.reflect.GeneratedMethodAccessor229.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
	at com.cloudbees.groovy.cps.Next.step(Next.java:83)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
	at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
	at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122)
	at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261)
	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:331)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:82)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:243)
	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:231)
	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:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

However I have included hudson.FilePath in the plugin, what am I not getting here.

Thanks,
Rijo

On Fri, Jan 5, 2018 at 11:45 AM, Jesse Glick <[hidden email]> wrote:
On Fri, Jan 5, 2018 at 2:36 PM, Rijo Simon <[hidden email]> wrote:
> java.lang.NoSuchMethodError: No such DSL method 'step' found among steps

Install the `workflow-basic-steps` plugin.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/hJmQwbFbm08/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2W7fEsdrd7P5swyZdZg6Ofyn4afVV9U%2BHdVMOHBj6eTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
-- Rijo S.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAGzyBaNmxondG%2BLN5GGx302k7p0tHgV-%3DaKsXw9t_PsJo8vWmA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Jesse Glick-4
On Fri, Jan 5, 2018 at 3:30 PM, Rijo Simon <[hidden email]> wrote:
> org.jenkinsci.plugins.workflow.steps.MissingContextVariableException:
> Required context class hudson.FilePath is missing

`step` may only be called inside `node`.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr2Sq0NYzYpRJqq21UFaEywEj_QhnvX0FMcjF3HAOu0iUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
On adding node block I get the error: java.lang.NoSuchMethodError: No such DSL method 'node' found among steps

On Friday, January 5, 2018 at 12:37:30 PM UTC-8, Jesse Glick wrote:
On Fri, Jan 5, 2018 at 3:30 PM, Rijo Simon <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Wvid6TQBEgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ri...@...> wrote:
> org.jenkinsci.plugins.workflow.steps.MissingContextVariableException:
> Required context class hudson.FilePath is missing

`step` may only be called inside `node`.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5d26dc25-a29e-4e27-9465-883e12ee513f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Rijo Simon
This is my pipeline script: 
node{
step ([$class: 'GoBuildSandboxBuilder', product: 'gobuild_tiny_target', branch: 'main', changeset: 'False'])
}

On Friday, January 5, 2018 at 1:01:16 PM UTC-8, Rijo Simon wrote:
On adding node block I get the error: java.lang.NoSuchMethodError: No such DSL method 'node' found among steps

On Friday, January 5, 2018 at 12:37:30 PM UTC-8, Jesse Glick wrote:
On Fri, Jan 5, 2018 at 3:30 PM, Rijo Simon <[hidden email]> wrote:
> org.jenkinsci.plugins.workflow.steps.MissingContextVariableException:
> Required context class hudson.FilePath is missing

`step` may only be called inside `node`.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/e4c3ac9d-38cc-4f6e-8428-91bc54fa3313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Calling a DSL extension resulting in error

Daniel Beck
In reply to this post by Rijo Simon

> On 5. Jan 2018, at 22:01, Rijo Simon <[hidden email]> wrote:
>
> On adding node block I get the error: java.lang.NoSuchMethodError: No such DSL method 'node' found among steps

Per https://jenkins.io/doc/pipeline/steps/ the 'node' step is provided by the 'Pipeline: Nodes and Processes' plugin which you probably don't have installed.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/86A72C39-BDA0-475F-A507-55FCB9F5D56B%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.