Access M2 Release Plugin release permission through groovy

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

Access M2 Release Plugin release permission through groovy

Tina Danielsson
I'm trying to create a groovy script where I set the release permissions fort he M2 Release Plugin. But I can't figure out how to do that. The build in permissons can be accessed via hudson.model.Item.PROPERTY, for example hudson.model.Item.CANCEL. But hudson.model.Item.Release just returns "No such property".

Any ideas on how to access this property?

import hudson.security.*

def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
def authorizationMatrixProperty = job.getProperty(AuthorizationMatrixProperty.class)

authorizationMatrixProperty
?.add(hudson.model.Item.CANCEL,"TESTUSER")
authorizationMatrixProperty
?.add(hudson.model.Item.RELEASE,"TESTUSER")


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5ec977b3-a9bf-44fe-9ec7-529fc584fcb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Access M2 Release Plugin release permission through groovy

Logan Twedt
Hi Tina, et all,

I'm also trying to configure the Release permission using a groovy script. I do see that the permission is called CREATE_RELEASE inside an inner class in the m2Release plugin code on GitHub: https://github.com/jenkinsci/m2release-plugin/blob/2f2865cffdd7e4be2a60156f245fabc9508d870b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java - but I've also tried that Permission name and it doesn't work. Maybe I'm reading that code wrong, not sure.

Has anyone been able to get this working?

-Logan

On Thursday, April 6, 2017 at 9:59:42 AM UTC-5, Tina Danielsson wrote:
I'm trying to create a groovy script where I set the release permissions fort he M2 Release Plugin. But I can't figure out how to do that. The build in permissons can be accessed via hudson.model.Item.PROPERTY, for example hudson.model.Item.CANCEL. But hudson.model.Item.Release just returns "No such property".

Any ideas on how to access this property?

import hudson.security.*

def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
def authorizationMatrixProperty = job.getProperty(AuthorizationMatrixProperty.class)

authorizationMatrixProperty
?.add(hudson.model.Item.CANCEL,"TESTUSER")
authorizationMatrixProperty
?.add(hudson.model.Item.RELEASE,"TESTUSER")


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Access M2 Release Plugin release permission through groovy

teilo
Did you try
    org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper.DescriptorImpl.CREATE_RELEASE ?

/James



On 5/16/2017 7:50 PM, Logan Twedt wrote:
Hi Tina, et all,

I'm also trying to configure the Release permission using a groovy script. I do see that the permission is called CREATE_RELEASE inside an inner class in the m2Release plugin code on GitHub: https://github.com/jenkinsci/m2release-plugin/blob/2f2865cffdd7e4be2a60156f245fabc9508d870b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java - but I've also tried that Permission name and it doesn't work. Maybe I'm reading that code wrong, not sure.

Has anyone been able to get this working?

-Logan

On Thursday, April 6, 2017 at 9:59:42 AM UTC-5, Tina Danielsson wrote:
I'm trying to create a groovy script where I set the release permissions fort he M2 Release Plugin. But I can't figure out how to do that. The build in permissons can be accessed via hudson.model.Item.PROPERTY, for example hudson.model.Item.CANCEL. But hudson.model.Item.Release just returns "No such property".

Any ideas on how to access this property?

import hudson.security.*

def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
def authorizationMatrixProperty = job.getProperty(AuthorizationMatrixProperty.class)

authorizationMatrixProperty
?.add(hudson.model.Item.CANCEL,"TESTUSER")
authorizationMatrixProperty
?.add(hudson.model.Item.RELEASE,"TESTUSER")


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%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 Users" 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-users/10f8985b-6acb-1cec-a85b-1ce48ab591b5%40teilo.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Access M2 Release Plugin release permission through groovy

Tina Danielsson
You are my hero James! It worked :)

import hudson.security.*
import org.jvnet.hudson.plugins.m2release.*

def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
def authorizationMatrixProperty = job.getProperty(AuthorizationMatrixProperty.class)

authorizationMatrixProperty?.add(M2ReleaseBuildWrapper.DescriptorImpl.CREATE_RELEASE,"TESTUSER")



On Wednesday, 17 May 2017 23:19:49 UTC+2, James Nord wrote:
Did you try
    org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper.DescriptorImpl.CREATE_RELEASE ?

/James



On 5/16/2017 7:50 PM, Logan Twedt wrote:
Hi Tina, et all,

I'm also trying to configure the Release permission using a groovy script. I do see that the permission is called CREATE_RELEASE inside an inner class in the m2Release plugin code on GitHub: <a href="https://github.com/jenkinsci/m2release-plugin/blob/2f2865cffdd7e4be2a60156f245fabc9508d870b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fm2release-plugin%2Fblob%2F2f2865cffdd7e4be2a60156f245fabc9508d870b%2Fsrc%2Fmain%2Fjava%2Forg%2Fjvnet%2Fhudson%2Fplugins%2Fm2release%2FM2ReleaseBuildWrapper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhqeTSFNhMsODJCWQVkyVuhUGOxA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fm2release-plugin%2Fblob%2F2f2865cffdd7e4be2a60156f245fabc9508d870b%2Fsrc%2Fmain%2Fjava%2Forg%2Fjvnet%2Fhudson%2Fplugins%2Fm2release%2FM2ReleaseBuildWrapper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEhqeTSFNhMsODJCWQVkyVuhUGOxA&#39;;return true;">https://github.com/jenkinsci/m2release-plugin/blob/2f2865cffdd7e4be2a60156f245fabc9508d870b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java - but I've also tried that Permission name and it doesn't work. Maybe I'm reading that code wrong, not sure.

Has anyone been able to get this working?

-Logan

On Thursday, April 6, 2017 at 9:59:42 AM UTC-5, Tina Danielsson wrote:
I'm trying to create a groovy script where I set the release permissions fort he M2 Release Plugin. But I can't figure out how to do that. The build in permissons can be accessed via hudson.model.Item.PROPERTY, for example hudson.model.Item.CANCEL. But hudson.model.Item.Release just returns "No such property".

Any ideas on how to access this property?

import hudson.security.*

def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
def authorizationMatrixProperty = job.getProperty(AuthorizationMatrixProperty.class)

authorizationMatrixProperty
?.add(hudson.model.Item.CANCEL,"TESTUSER")
authorizationMatrixProperty
?.add(hudson.model.Item.RELEASE,"TESTUSER")


--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Y2U4FKOiAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ff456b35-6552-4830-af89-801e94b9b1b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.