0

I'm trying to integrate XRay in my Jenkins pipeline. For that I'm adding a step like this:

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"
} 
"""

When running the pipeline I'm getting the following error:

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.

I don't know how to fix this problem. Any idea what could be wrong with this setup, or how could I debug this?

Carabes
  • 532
  • 2
  • 4
  • 16
  • I think you may need to resave the project/job configuration in Jenkins as the Xray instance configuration may be orphaned somehow. maybe there was a recent plugin upgrade? – Sérgio May 20 '21 at 18:10
  • if this solved your issue, can you please mark the answer as correct? thanks :) – Sérgio Jun 01 '21 at 13:09

1 Answers1

1

You need to define the "serverInstance" variable. An example would be something like:

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

Please see some additional examples here.

Sérgio
  • 1,777
  • 2
  • 10
  • 12