setting the description of a view in pipelines

17 views
Skip to first unread message

Richard Ginga

unread,
May 25, 2017, 8:20:06 AM5/25/17
to jenkins...@googlegroups.com
I want to build a table and put is as a view's description. I found the below code that does work in the script console but in a pipeline it shows no failure but does not work. here the the entire pipeline:

import org.kohsuke.stapler.StaplerRequest
import org.kohsuke.stapler.StaplerResponse

stage ('stage1') {
            Hudson.instance.getView('Testing').doSubmitDescription([ getParameter: { return "zzzzxxxxyyyy"; }] as StaplerRequest, [ sendRedirect: { return; } ] as StaplerResponse)
}


--
Dick Ginga
Build Engineer

Richard Ginga

unread,
Jul 6, 2017, 1:44:47 PM7/6/17
to jenkins...@googlegroups.com

To All, 

I want to build a table and put it as a view's description. I found the below code that does work in the script console but in a scripted pipeline it shows no failure but does not work. 

Here the the entire pipeline:

import org.kohsuke.stapler.StaplerRequest
import org.kohsuke.stapler.StaplerResponse

stage ('stage1') {
            Hudson.instance.getView('Testing').doSubmitDescription([ getParameter: { return "zzzzxxxxyyyy"; }] as StaplerRequest, [ sendRedirect: { return; } ] as StaplerResponse)
}

and here is the code in Git:

/**
* Accepts the new description.
*/
@RequirePOST
public synchronized void doSubmitDescription( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
checkPermission(CONFIGURE);
description = req.getParameter("description");
save();
rsp.sendRedirect("."); // go to the top page
}

What am I doing wrong?
-- 
Reply all
Reply to author
Forward
0 new messages