Job Ownership Plugin Button

52 views
Skip to first unread message

Brett Dupree

unread,
May 19, 2017, 5:21:05 AM5/19/17
to Jenkins Developers

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)

Oleg Nenashev

unread,
May 21, 2017, 5:57:14 PM5/21/17
to Jenkins Developers
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 написал:

Brett Dupree

unread,
May 23, 2017, 12:46:29 AM5/23/17
to Jenkins Developers
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. 

Oleg Nenashev

unread,
May 31, 2017, 3:28:00 AM5/31/17
to Jenkins Developers
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 написал:
Reply all
Reply to author
Forward
0 new messages