How to extend Jenkins job page with new links and icons

后端 未结 5 1026
难免孤独
难免孤独 2021-02-14 13:29

I\'m developing my first Jenkins plugin and followed the tutorial at wiki.jenkins-ci.org. After adding a BuildStep and generating the results I now want to publish them to the u

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-14 13:39

    As it happens, there was a plugin workshop by Steven Christou at the recent Jenkins User Conference in Boston, which covered this case. You need to add a new RootAction, as shown in the following code from the JUC session

    package org.jenkinsci.plugins.JUCBeer;
    
    import hudson.Extension;
    import hudson.model.RootAction;
    
    @Extension
    public class JenkinsRootAction implements RootAction {
        public String getIconFileName() {
            return "/images/jenkins.png";
        }
    
        public String getDisplayName() {
            return "Jenkins home page";
        }
    
        public String getUrlName() {
            return "http://jenkins-ci.org";
        }
    }
    

提交回复
热议问题