“ Zephyr for JIRA”的Jenkins SERVER插件不起作用+无法调用ZAPI API

时间:2019-04-28 18:12:40

标签: jenkins jira-zephyr

我有一个设置,其中JIRA的Zephyr安装在JIRA服务器(不是云)上。 ZAPI也安装在同一JIRA实例上。我有一个Jenkins作业,该作业正在运行五个用Maven构建并驻留在GitLab存储库中的JUnit4单元测试。我也可以通过Jenkins的工作创建Maven Surefire报告。当我尝试“将测试结果发布到Zephyr for JIRA”时,此生成后步骤最终失败,并显示以下错误消息:

<normal build output...>
<...>
Recording test results
[ZapiTestResultReporter] [INFO] Examining test results...
Build result is SUCCESS
Total Test Cases : 5ERROR: Build step failed with exception
org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
    at org.json.JSONTokener.syntaxError(JSONTokener.java:433)
    at org.json.JSONObject.<init>(JSONObject.java:194)
    at org.json.JSONObject.<init>(JSONObject.java:321)
    at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.assignTests(TestCaseUtil.java:315)
    at com.thed.zephyr.jenkins.utils.rest.TestCaseUtil.processTestCaseDetails(TestCaseUtil.java:641)
    at com.thed.zephyr.jenkins.reporter.ZfjReporter.perform(ZfjReporter.java:101)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690)
    at hudson.model.Build$BuildExecution.post2(Build.java:186)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:635)
    at hudson.model.Run.execute(Run.java:1841)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Build step 'Publish test result to Zephyr for JIRA' marked build as failure
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE

我们有一个设置,其中JIRA和Jenkins不在AWS的同一VPC上。我们必须在两端都打开8080,以便JIRA和Jenkins可以进行交谈。

(也许不相关,但是在配置此构建后步骤时,有时测试周期下拉列表中不会包含手动创建的周期信息。)

根据documentation的内容似乎并不奇怪。

这是我的两个问题:

  1. 有人知道如何在Jenkins工作中解决此错误吗?
  2. 我尝试按照此documentation调用ZAPI终结点,而不是在Jenkins上将Zephyr用于JIRA插件。但是,例如,当我尝试点击https:/// jira / rest / zapi / latest / util / zephyrTestIssueType端点时,我一直在获取: Oops! Looks like you have found a broken link

我正在使用基本身份验证通过以下代码访问此API端点:

        Client client = ClientBuilder.newClient();
        Response response = client.target("https://" + jiraHostname + "/zephyr/rest/zapi/latest/cycle")
                .request(MediaType.APPLICATION_JSON_TYPE)
                .header("Authorization", "Basic " + base64UsernamePassword)
                .get();

        System.out.println("status: " + response.getStatus());
        System.out.println("headers: " + response.getHeaders());
        System.out.println("body:" + response.readEntity(String.class));

对于使用ZAPI服务器(而非云)时如何命中ZAPI终结点,养蜂场文档未作任何提及。 “ JIRA主机名”是要命中才能到达ZAPI端点的主机名吗?在Apiary上,它们只允许使用几个预先配置的主机名-我认为这仅适用于ZAPI云。

有人知道正确的解决方案吗?或者可以向我指出某个地方的一些文档?

0 个答案:

没有答案