Job Ownership Plugin Button

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

Job Ownership Plugin Button

Brett Dupree

Hello Jenkins Users,

 

I am looking over the Job Ownership plugin and it is very close to what I need to complete an assignment

https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin

 

What I need is a button in the view. Where if the current user clicks the button, they check out the job and are made the owner. After that only the current user and the Jenkins admin is able to change the user. When the user is done with the build/job they are able to select the button which now says “Check-in”. “Check-in” then spawns a job that cleans up the environment. Also who is the current owner is either on the button or below the button.


Has anyone already implemented something of this nature?

Thanks you for reading!

Brett Dupree (Beyondsoft)

--
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/08bc7507-ffea-4d78-a3d7-5078f394d6e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Job Ownership Plugin Button

Oleg Nenashev
So, I am copy-pasting my response to the private email with similar question...

Yes, it is possible to add such button. There is the JobOwnerHelper and FolderOwnershipHelper classes, which provide proper API, which you can invoke from the ListViewColumn implementation. OwnershipHelperLocator may help as well though ownership change methods are not a part of the default API.

If the implementation is done in a generic way, I think it may be even added directly to the plugin. Once you have something working, please feel free to create a pull request. Just in case you have any questions there is a not-so-populated chat in Gitter: https://gitter.im/jenkinsci/ownership-plugin

Brett, feel free to follow-up in this thread. Since I have responded earlier than you've sent this email, I assume that something is unclear.

пятница, 19 мая 2017 г., 11:21:05 UTC+2 пользователь Brett Dupree написал:

Hello Jenkins Users,

 

I am looking over the Job Ownership plugin and it is very close to what I need to complete an assignment

<a href="https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FOwnership%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDWZKQbAKMfKIvM4m3kBUcGKqyJg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FOwnership%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDWZKQbAKMfKIvM4m3kBUcGKqyJg&#39;;return true;">https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin

 

What I need is a button in the view. Where if the current user clicks the button, they check out the job and are made the owner. After that only the current user and the Jenkins admin is able to change the user. When the user is done with the build/job they are able to select the button which now says “Check-in”. “Check-in” then spawns a job that cleans up the environment. Also who is the current owner is either on the button or below the button.


Has anyone already implemented something of this nature?

Thanks you for reading!

Brett Dupree (Beyondsoft)

--
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/8ad4e9f4-dc8d-41d4-897c-c5697ae6f192%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Job Ownership Plugin Button

Brett Dupree
I got your e-mail. The wiki suggested I also post here just in case there was someone who already added onto the plugin or came up with a solution that I haven't considered. Sorry I did not e-mail you back. Thank you for your reply. 

On Sunday, May 21, 2017 at 2:57:14 PM UTC-7, Oleg Nenashev wrote:
So, I am copy-pasting my response to the private email with similar question...

Yes, it is possible to add such button. There is the <a onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsynopsys%2Farc%2Fjenkins%2Fplugins%2Fownership%2Fjobs%2FJobOwnerHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGtHeL4WhkRRNW66FRI30xSLf56eQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsynopsys%2Farc%2Fjenkins%2Fplugins%2Fownership%2Fjobs%2FJobOwnerHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGtHeL4WhkRRNW66FRI30xSLf56eQ&#39;;return true;" href="https://github.com/jenkinsci/ownership-plugin/blob/master/src/main/java/com/synopsys/arc/jenkins/plugins/ownership/jobs/JobOwnerHelper.java" target="_blank" rel="nofollow">JobOwnerHelper and <a onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Forg%2Fjenkinsci%2Fplugins%2Fownership%2Fmodel%2Ffolders%2FFolderOwnershipHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFb_-F_Oa5SFV4vzS9B1JS1hiDQSw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Forg%2Fjenkinsci%2Fplugins%2Fownership%2Fmodel%2Ffolders%2FFolderOwnershipHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFb_-F_Oa5SFV4vzS9B1JS1hiDQSw&#39;;return true;" href="https://github.com/jenkinsci/ownership-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ownership/model/folders/FolderOwnershipHelper.java" target="_blank" rel="nofollow">FolderOwnershipHelper classes, which provide proper API, which you can invoke from the ListViewColumn implementation. OwnershipHelperLocator may help as well though ownership change methods are not a part of the default API.

If the implementation is done in a generic way, I think it may be even added directly to the plugin. Once you have something working, please feel free to create a pull request. Just in case you have any questions there is a not-so-populated chat in Gitter: <a onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitter.im%2Fjenkinsci%2Fownership-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHwbeZhpz870Ur_NZbl_7PsbWqXFg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitter.im%2Fjenkinsci%2Fownership-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHwbeZhpz870Ur_NZbl_7PsbWqXFg&#39;;return true;" href="https://gitter.im/jenkinsci/ownership-plugin" target="_blank" rel="nofollow">https://gitter.im/jenkinsci/ownership-plugin

Brett, feel free to follow-up in this thread. Since I have responded earlier than you've sent this email, I assume that something is unclear.

пятница, 19 мая 2017 г., 11:21:05 UTC+2 пользователь Brett Dupree написал:

Hello Jenkins Users,

 

I am looking over the Job Ownership plugin and it is very close to what I need to complete an assignment

<a onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FOwnership%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDWZKQbAKMfKIvM4m3kBUcGKqyJg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FOwnership%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDWZKQbAKMfKIvM4m3kBUcGKqyJg&#39;;return true;" href="https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin" target="_blank" rel="nofollow">https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin

 

What I need is a button in the view. Where if the current user clicks the button, they check out the job and are made the owner. After that only the current user and the Jenkins admin is able to change the user. When the user is done with the build/job they are able to select the button which now says “Check-in”. “Check-in” then spawns a job that cleans up the environment. Also who is the current owner is either on the button or below the button.


Has anyone already implemented something of this nature?

Thanks you for reading!

Brett Dupree (Beyondsoft)

--
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/fdf0318b-32b3-4de4-8327-3c7555130a7c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Job Ownership Plugin Button

Oleg Nenashev
Yes, it is a right approach.
I just re-posted my email in order to have all the things in a single thread.

I think it makes sense to just add such buttons to the plugin itself though the use-case needs to be generic enough. Previously I've done something like that for the "sudo" mode for Jenkins admins (button, which elevates and resets permissions), but it has been done via the Role Strategy System groovy macro.

Maybe for your case it makes sense to create something like "Scripted Action" plugin, which would allow admins to define custom logic including List View Buttons. Scriptler could be the best place for such functionality, but unfortunately the plugin is disabled now due to security reasons.

If I implement the REST API endpoints, probably it will be possible to use the Sidebar Links plugin though it will require some magic with GET/POST requests.

BR, Oleg

вторник, 23 мая 2017 г., 6:46:29 UTC+2 пользователь Brett Dupree написал:
I got your e-mail. The wiki suggested I also post here just in case there was someone who already added onto the plugin or came up with a solution that I haven't considered. Sorry I did not e-mail you back. Thank you for your reply. 

On Sunday, May 21, 2017 at 2:57:14 PM UTC-7, Oleg Nenashev wrote:
So, I am copy-pasting my response to the private email with similar question...

Yes, it is possible to add such button. There is the <a href="https://github.com/jenkinsci/ownership-plugin/blob/master/src/main/java/com/synopsys/arc/jenkins/plugins/ownership/jobs/JobOwnerHelper.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsynopsys%2Farc%2Fjenkins%2Fplugins%2Fownership%2Fjobs%2FJobOwnerHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGtHeL4WhkRRNW66FRI30xSLf56eQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Fcom%2Fsynopsys%2Farc%2Fjenkins%2Fplugins%2Fownership%2Fjobs%2FJobOwnerHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGtHeL4WhkRRNW66FRI30xSLf56eQ&#39;;return true;">JobOwnerHelper and <a href="https://github.com/jenkinsci/ownership-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ownership/model/folders/FolderOwnershipHelper.java" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Forg%2Fjenkinsci%2Fplugins%2Fownership%2Fmodel%2Ffolders%2FFolderOwnershipHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFb_-F_Oa5SFV4vzS9B1JS1hiDQSw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fownership-plugin%2Fblob%2Fmaster%2Fsrc%2Fmain%2Fjava%2Forg%2Fjenkinsci%2Fplugins%2Fownership%2Fmodel%2Ffolders%2FFolderOwnershipHelper.java\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFb_-F_Oa5SFV4vzS9B1JS1hiDQSw&#39;;return true;">FolderOwnershipHelper classes, which provide proper API, which you can invoke from the ListViewColumn implementation. OwnershipHelperLocator may help as well though ownership change methods are not a part of the default API.

If the implementation is done in a generic way, I think it may be even added directly to the plugin. Once you have something working, please feel free to create a pull request. Just in case you have any questions there is a not-so-populated chat in Gitter: <a href="https://gitter.im/jenkinsci/ownership-plugin" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitter.im%2Fjenkinsci%2Fownership-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHwbeZhpz870Ur_NZbl_7PsbWqXFg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgitter.im%2Fjenkinsci%2Fownership-plugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHwbeZhpz870Ur_NZbl_7PsbWqXFg&#39;;return true;">https://gitter.im/jenkinsci/ownership-plugin

Brett, feel free to follow-up in this thread. Since I have responded earlier than you've sent this email, I assume that something is unclear.

пятница, 19 мая 2017 г., 11:21:05 UTC+2 пользователь Brett Dupree написал:

Hello Jenkins Users,

 

I am looking over the Job Ownership plugin and it is very close to what I need to complete an assignment

<a href="https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FOwnership%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDWZKQbAKMfKIvM4m3kBUcGKqyJg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FOwnership%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHDWZKQbAKMfKIvM4m3kBUcGKqyJg&#39;;return true;">https://wiki.jenkins-ci.org/display/JENKINS/Ownership+Plugin

 

What I need is a button in the view. Where if the current user clicks the button, they check out the job and are made the owner. After that only the current user and the Jenkins admin is able to change the user. When the user is done with the build/job they are able to select the button which now says “Check-in”. “Check-in” then spawns a job that cleans up the environment. Also who is the current owner is either on the button or below the button.


Has anyone already implemented something of this nature?

Thanks you for reading!

Brett Dupree (Beyondsoft)

--
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/134d2c8e-ea61-4748-a3bd-29cf3d01ad1b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.