reportportal / service-jira

EPAM Report portal. Jira Integration
GNU General Public License v3.0
9 stars 8 forks source link

Unable to post issue from ReportPortal due to validation issue #16

Closed kovaku closed 4 years ago

kovaku commented 5 years ago

Summary

My team just have deployed jira service to our locally hosted Report Portal cluster, the service is able to communicate with Jira and also it is possible to configure the BTS under the project specific settings. However when I try to post an issue using Report Portal then the following validation issue occurs:

Error occurred: {"error_code":40302,"message":"Impossible interact with external system. [ErrorCollectionstatus=400, errors=customfield_12231=Could not find valid 'id' or 'value' in the Parent Option object., Found in Phase=data was not an array, customfield_15842=Could not find valid 'id' or 'value' in the Parent Option object., errorMessages=[]]"}

The following logs are displayed on the console of the jira service:

com.epam.ta.reportportal.exception.ReportPortalException: Impossible interact with external system. [ErrorCollectionstatus=400, errors=customfield_12231=Could not find valid 'id' or 'value' in the Parent Option object., Found in Phase=data was not an array, customfield_15842=Could not find valid 'id' or 'value' in the Parent Option object., errorMessages=[]]
    at com.epam.reportportal.extension.bugtracking.jira.JiraStrategy.submitTicket(JiraStrategy.java:193) ~[classes!/:na]

The extracted request to BTS:

2019-08-08 07:29:21.440 DEBUG 1 --- [O dispatcher 21] org.apache.http.wire                     : http-outgoing-2 >> "{"fields":{"summary":"Failing test","issuetype":{"id":"1"},"customfield_12231":"ReportPortal autofield","project":{"key":"XXX"},"description":"Failing test\nh3.*Back link to Report Portal:*\n - [Link to defect|http:\/\/XXXXX\/#XXXX\/launches\/all%7Cpage.page=1&page.size=50&page.sort=start_time\/5d39b72eb1d5fc000170060b%7Cpage.page=1&page.size=50&page.sort=start_time&filter.eq.has_childs=false&filter.eq.uniqueId=%5Bengine:junit-jupiter%5D\/%5Bclass:com.xxxxx.xxxxxx.xxxxxxxxxxx.e2e.XXXXXServiceE2E%5D?page.page=1&page.size=50&page.sort=start_time&filter.eq.has_childs=false&filter.eq.uniqueId=%5Bengine:junit-jupiter%5D\/%5Bclass:com.xxxxx.xxxxxx.xxxxxxxxxxx.e2e.XXXXXServiceServiceE2E%5D&log.item=5d39b72eb1d5fc000170060d]\n\n","customfield_15842":"ReportPortal autofield","customfield_11532":"ReportPortal autofield"}}"

After analyzing the related code it turned out that the field that caused validation issue were set to ReportPortal autofield due to the following exception:

2019-08-08 07:29:19.374 ERROR 1 --- [nio-8080-exec-7] c.e.r.e.b.jira.JIRATicketUtils           : null

java.lang.NullPointerException: null
    at com.epam.reportportal.extension.bugtracking.jira.JIRATicketUtils.toIssueInput(JIRATicketUtils.java:157) ~[classes!/:na]
    at com.epam.reportportal.extension.bugtracking.jira.JiraStrategy.submitTicket(JiraStrategy.java:162) [classes!/:na]
    at com.epam.reportportal.extension.bugtracking.BugTrackingController.submitTicket(BugTrackingController.java:74) [commons-bugtracking-4.2.0.jar!/:na]

Notes about the fields that are affected by this issue:

  {
    "id": "customfield_12231",
    "name": "Bug Classification",
    "custom": true,
    "orderable": true,
    "navigable": true,
    "searchable": true,
    "clauseNames": [
      "Bug Classification",
      "cf[12231]"
    ],
    "schema": {
      "type": "option",
      "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
      "customId": 12231
    }
  }
"customfield_12231":{"required":true,"schema":{"type":"option","custom":"com.atlassian.jira.plugin.system.customfieldtypes:select","customId":12231},"name":"Bug Classification","hasDefaultValue":true,"operations":["set"],"allowedValues":[{"self":"https://XXXX.XXX/rest/api/2/customFieldOption/14583","value":"New Feature Bug","id":"14583"},{"self":"https://XXXX.XXX/rest/api/2/customFieldOption/14880","value":"Production Bug","id":"14880"},{"self":"https://XXXX.XXX/rest/api/2/customFieldOption/14584","value":"Regression Bug","id":"14584"},{"self":"https://XXXX.XXX/rest/api/2/customFieldOption/14585","value":"Unknown","id":"14585"}]}
  {
    "id": "customfield_15842",
    "name": "Theme",
    "custom": true,
    "orderable": true,
    "navigable": true,
    "searchable": true,
    "clauseNames": [
      "cf[15842]",
      "Theme"
    ],
    "schema": {
      "type": "option",
      "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
      "customId": 15842
    }
  },
customfield_15842":{"required":false,"schema":{"type":"option","custom":"com.atlassian.jira.plugin.system.customfieldtypes:select","customId":15842},"name":"Theme","hasDefaultValue":false,"operations":["set"],"allowedValues":[.....

Affected version: Jira Service: 4.3.0 Jira version: JIRA v7.6.4

Could you please support us to find out the rootcause of this issue?

evjlobanova commented 4 years ago

Please, update your version of ReportPortal to the latest one - 5.0 And try to use Jira plugin

jsingh-qualitrol commented 4 years ago

@evjlobanova I was able to post issue to Jira successfully once. Instead of bug, Epic was configured in Jira plugin 5.0.1,so i had to change it back to bug. Now i am unable to post issue to JIra. I had verified the credential by login to jira. And trying to connect with Superadmin rights. I had reinstall jira plugin again to confirm but no luck. Can anyone help me with the issue. image

evjlobanova commented 4 years ago

Do you Bug form has custom fields in Jira?

jsingh-qualitrol commented 4 years ago

yes we have few link EPIC , Labels, Sprint as custom field in jira.

evjlobanova commented 4 years ago

We have a problem with custom fields Could you please try to report issue without custom field?

jsingh-qualitrol commented 4 years ago

Now i tried without custom fields, but no luck image

evjlobanova commented 4 years ago

Any steps to reproduce?

jsingh-qualitrol commented 4 years ago

I am using following configuration : image Also i am using MSTest framework . I installed Jira plugin 5.0.1 bts and i configured the Epic as issue to be posted to jira Then it worked as expected. Then i wanted to post bug instead of EPic to jira , for this i changed the configuration to Bug instead of EPIC. Then tried to post the bug to jira , but no luck .

Hope this would help you to reproduce the issue!!

jsingh-qualitrol commented 4 years ago

@evjlobanova where you able to get clue on how it can be resolved?

jsingh-qualitrol commented 4 years ago

@kovaku Is your issue of posting bug to jira was solved ? If yes, how did you resolve it? Please help i am stuck here .

kovaku commented 4 years ago

@jsingh-qualitrol Unfortunately not, since we were unable to upgrade to version 5, therefore we decided to drop the idea to have jira integration.

evjlobanova commented 4 years ago

@jsingh-qualitrol Which credentials do you use? Do you use the token instead of password? Could you please try to post not a bug, but another type, and let me know about results?

jsingh-qualitrol commented 4 years ago

@evjlobanova I have tried with Jira credential. And also tried with password and token both. Apart from bug, i had also tried to Epic and now with Epic it is not working. Removed all custom fields as well. But no luck.

evjlobanova commented 4 years ago

@jsingh-qualitrol do you have slack or skype?

jsingh-qualitrol commented 4 years ago

slack

jsingh-qualitrol commented 4 years ago

I am user in ReportPortal with id jyotidgs.

evjlobanova commented 4 years ago

Please contact me there https://reportportal.slack.com/archives/C2GTJTTNH

Swati-singh1 commented 3 years ago

@evjlobanova I am facing a similar issue with posting an issue to Jira from ReportPortal. We are using Jira cloud instance.Error just tells failed to post issue. Although link an issue feature is working fine.

alizaidi96 commented 1 year ago

@evjlobanova I am able to create issues on Jira but only through the account whose Jira access token was added while adding the Jira integration. Is it possible for multiple users to post issues as well? I am asking this because we have a big QA team and a lot of people are analysing the launches and raising bugs in Jira so it would be great if we can have multiple users who are able to post issues in Jira and not only the one account whose access token was added.