[PLUGIN DEV] Stapler and Jelly

26 views
Skip to first unread message

Zsolt Barnabás Garda

unread,
Oct 28, 2016, 6:20:19 AM10/28/16
to Jenkins Developers
Hello all,

I'm a beginner plugin developer, and I'm not sure how to use Stapler with Jelly.
My post build plugin has a summary.jelly that shows some information on the build pages of the project.
What I want is to have links in that summary in order to navigate to other pages showing some additional information.

In that summary.jelly that belongs to a class implementing Action and has a method : public void doGraph(StaplerRequest req, StaplerResponse rsp)
(that writes a picture to the response) I put the followings:

        <a href="myplugin/graph">
            show all plots for all tests
        </a>

So when I click the link, a new HTML page is shown with the single picture.

However what I want to achieve is to show pictures "inside" the Jenkins UI (have the Jenkins header and sidebar, etc...) and have a jelly file that
produces the output in order to put more pictures in a table. (I guess the latter is achiveable in a jelly:for).

Could you provide me some guidance please?

I already looked at the source of the JUnit plugin (https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Plugin)
and the Plot plugin (https://wiki.jenkins-ci.org/display/JENKINS/Plot+Plugin) but I find it hard to figure out how to move on.
What I also tried is to acquire the source of the Console output action built into Jenkins because it might have some simple source I could use to understand
the way to do this but I couldn't.

Thank you,
Barnie

Daniel Beck

unread,
Oct 28, 2016, 6:52:20 AM10/28/16
to jenkin...@googlegroups.com

> On 28.10.2016, at 12:20, Zsolt Barnabás Garda <garda....@gmail.com> wrote:
>
> Hello all,
>
> I'm a beginner plugin developer, and I'm not sure how to use Stapler with Jelly.
> My post build plugin has a summary.jelly that shows some information on the build pages of the project.
> What I want is to have links in that summary in order to navigate to other pages showing some additional information.
>
> In that summary.jelly that belongs to a class implementing Action and has a method : public void doGraph(StaplerRequest req, StaplerResponse rsp)
> (that writes a picture to the response) I put the followings:
>
> <a href="myplugin/graph">
> show all plots for all tests
> </a>
>
> So when I click the link, a new HTML page is shown with the single picture.
>
> However what I want to achieve is to show pictures "inside" the Jenkins UI (have the Jenkins header and sidebar, etc...) and have a jelly file that
> produces the output in order to put more pictures in a table. (I guess the latter is achiveable in a jelly:for).

Create a whatever.jelly file in the same directory as the summary.jelly. Put the entire view in there. To make it look 'like Jenkins', wrap your content in <l:layout> and <l:main-panel> tags.

Then, from your summary.jelly, link to myplugin/whatever.

Reply all
Reply to author
Forward
0 new messages