Thanks a million, Vincent! This worked like a charm. Kirill.
вторник, 10 февраля 2015 г., 18:39:54 UTC пользователь Vincent Latombe написал: > > Hi, > > In the #perform, method of your Builder, create an instance of your Action > and add it to the Build object. > > In your case, I don't think you need to implement a > TransientActionFactory. > > Vincent > > 2015-02-10 17:55 GMT+01:00 Kirill <[email protected] <javascript:>>: > >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/jenkinsci-dev/c5da95d8-55bc-4464-92c3-ea34c270bb8a%40googlegroups.com >> >> <https://groups.google.com/d/msgid/jenkinsci-dev/c5da95d8-55bc-4464-92c3-ea34c270bb8a%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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/eb35bf67-4c2d-4401-9542-1938e69ae571%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
