Hi folks,

I created a plugin that contains a custom Builder. It is included in job XX 
on my Jenkins. 

What I need is to add a link to the left-hand side of any build of any job 
in Jenkins, if it contains this build step. Say, if I create a job YY, this 
link has to appear on the left hand side when I go to the build details 
page (along with regular links like "Status", "Changes", etc.), as well as 
in job XX.

I used TransientActionFactory in the past, but I used it for a particular 
Build class. Not sure how to use it to work for any Build that has my 
Builder.

I made a naive attempt to do it like this, hoping that Jenkins will 
understand what I want (Builder is not Actionable, alas):

@Extension
public class MyLinkActionFactory extends TransientActionFactory<MyBuilder> {

    @Override
    public Class<MyBuilder> type() {
        return MyBuilder.class;
    }

    @Nonnull
    @Override
    public Collection<? extends Action> createFor(@Nonnull MyBuilder 
builder) {
            return Collections.singleton(new 
MyLinkAction("http://fullUrl";));
    }

}

public class MyLinkAction implements Action {
    private final String url;

    public MyLinkAction(String url) {
        this.url = url;
    }

    @Override
    public String getIconFileName() {
        return "/plugin/mystuff/images/24x24/ve.png";
    }

    @Override
    public String getDisplayName() {
        return "See the results";
    }

    @Override
    public String getUrlName() {
        return url;
    }
}

No surprize - it didn't work.
The only way out that I see is to use MyLinkActionFactory with any 
top-level item, but that will probably seriously slow down the Jenkins - 
and then somehow check whether it uses my Builder or not.:(

Any other more elegant solutions, people?

Regards,
Kirill.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/c5da95d8-55bc-4464-92c3-ea34c270bb8a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to