在 Jenkins 中使用 XrayImportBuilder 的问题

Problem using XrayImportBuilder in Jenkins

我正在尝试将 XRay 集成到我的 Jenkins 管道中。为此,我添加了这样的步骤:

step([$class: 'XrayImportBuilder', endpointName: '/cucumber/multipart',credentialId:'credentials', importFilePath: cucumber_json_path, importInfo: """{
    "fields": {
        "customfield_100" : "customfield",
        "description": "description",
        "issuetype": {
            "name": "name"
        },
        "labels": ["label"],
        "project": {
            "key": "key"
        },
    "summary": "summary"
},
"xrayFields": {
     "testPlanKey": "examplekey"
} 
"""

当 运行 管道出现以下错误时:

Starting XRAY: Results Import Task...

[2021-05-20T12:45:28.861Z] ##########################################################

[2021-05-20T12:45:28.861Z] ####     Xray is importing the execution results      ####

[2021-05-20T12:45:28.861Z] ##########################################################

[2021-05-20T12:45:28.861Z] XRAY_TEST_EXECS: 

[2021-05-20T12:45:28.861Z] XRAY_RAW_RESPONSE: The Jira server configuration of this task was not found.

[2021-05-20T12:45:28.861Z] XRAY_TESTS: 

[2021-05-20T12:45:28.861Z] XRAY_ISSUES_MODIFIED: 

[2021-05-20T12:45:28.861Z] XRAY_IS_REQUEST_SUCCESSFUL: false

The Jira server configuration of this task was not found.

我不知道如何解决这个问题。知道这个设置有什么问题吗,或者我该如何调试它?

您需要定义“serverInstance”变量。 一个例子是这样的:

step([$class: 'XrayExportBuilder', filePath: '\features', issues: 'IF-1', serverInstance: '2ffc3a3e-9e2f-4279-abcd-e9301fe47bed'])

请查看更多示例 here