Я разрабатываю плагин bamboo с использованием Atlassian-SDK. Этот плагин добавит новый вкладка на страницу Bamboo Jobs, который будет отображать HTML-отчет (присутствующий в артефакте) в том же вкладка.
Мой Atlassian-plugin.xml выглядит так
<xwork key = "viewRobotReport" name = "View Robot Report">
<package name = "RobotPlugin" extends = "buildResultView">
<action name = "viewRobotReport" class = "robot.RobotReport">
<result name = "success" type = "freemarker">viewRobotReport.ftl</result>
</action>
</package>
</xwork>
<web-item key = "RobotJob-${planKey}-${buildNumber}" name = "RobotReport" section = "results.subMenu/results" weight = "80">
<label key = "Robot Report"/>
<link linkId = "RobotBuild-${planKey}-${buildNumber}">/build/result/viewRobotReport.action?buildKey=${planKey}&buildNumber=${buildNumber}
</link>
<condition class = "robot.RobotReportViewCondition"/>
</web-item>
Я расширяю свой класс RobotReport из ViewBuildResults, чтобы получить подробную информацию об артефакте.
После того, как я нажму на вкладку, я получаю сообщение об ошибке
Apologies, this page could not be properly decorated (data is missing)
The URL for the page is 172.xx.x.x0:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1
Из журналов я вижу следующие ошибки
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,724 INFO [http-nio-6990-exec-12] [AccessLogFilter] admin GET http://172.20.1.30:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1&_=1525264904397 177957kb
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,725 ERROR [http-nio-6990-exec-12] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/build/result] and action name [viewRobotReport] associated with context path [/bamboo].
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,788 INFO [http-nio-6990-exec-9] [AccessLogFilter] admin GET http://172.20.1.30:6990/bamboo/build/result/viewRobotReport.action?buildKey=TPRO1-TPLAN1-JOB1&buildNumber=1 76808kb
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,789 ERROR [http-nio-6990-exec-9] [BambooStrutsUnknownHandler] There is no Action mapped for namespace [/build/result] and action name [viewRobotReport] associated with context path [/bamboo].
[INFO] [talledLocalContainer] 2018-05-02 13:41:48,819 ERROR [http-nio-6990-exec-9] [runtime] Error executing FreeMarker template
[INFO] [talledLocalContainer] FreeMarker template error:
[INFO] [talledLocalContainer] The following has evaluated to null or missing:
[INFO] [talledLocalContainer] ==> navigationContext [in template "decorators/resultDecorator.ftl" at line 17, column 18]
[INFO] [talledLocalContainer]
Я понимаю, что BambooStruts не может найти действие в пространстве имен / build / result в / бамбук.
Мой шаблон freemarker содержит только этот бит.
<html>
<head>
<meta name = "decorator" content = "result"/>
</head>
<body>
</body>
</html>
Как правильно добавить действие (viewRobotReport) в пространство имен bamboo / build / result?
На форумах разработчиков Bamboo нет рекомендаций по реализации этого. Где-то упоминается «установочная инъекция», но не совсем понятно, что это такое.
Любая крошечная подсказка будет принята с благодарностью. Заранее спасибо.
Я обнаружил, в чем проблема, когда просмотрел все журналы атлас. Я мог бы в журналах ниже ..
[INFO] [talledLocalContainer] 2018-05-03 13:30:07,737 ERROR [localhost-startStop-1] [BambooPluginUtils] A problem has occurred when instantiating action class [robot.RobotReport], skipping action [viewRobotReport]
[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'robot.RobotReport': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.atlassian.bamboo.storage.StorageLocationService com.atlassian.bamboo.build.ViewBuildResults.storageLocationService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.bamboo.storage.StorageLocationService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Я исправил это в коде, выполнив следующие действия ..
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
@Scanned
public class RobotReport extends ViewBuildResults {
public RobotReport(@ComponentImport StorageLocationService storageLocationService){
Полезная ссылка
Я вижу, что struts.xml не содержит приведенного ниже определения пакета
<package name = "RobotPlugin" extends = "buildResultView"> <action name = "viewRobotReport" class = "robot.RobotReport"> <result name = "success" type = "freemarker">viewRobotReport.ftl</result> </action> </package>
. Разве bamboo не должен автоматически обновлять struts.xml?