Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jira integration does not work #3141

Closed
bkosanovic opened this issue Apr 4, 2023 · 5 comments
Closed

Jira integration does not work #3141

bkosanovic opened this issue Apr 4, 2023 · 5 comments

Comments

@bkosanovic
Copy link

bkosanovic commented Apr 4, 2023

Description of problem

I added JIRA Change Bug Tracker as described in the documentation and I verified with the Configuration health check that configuration is OK and that I can use a Bug URL from our JIRA project to verify Kiwi TCMS can access it.

However, when I tried to create a bug from within a test case inside a test execution by clicking on "Report bug" from drop down menu at the right top side of the expanded view of the test case that is being executed, I've got a pop up with this:

Internal error: JiraError HTTP 404 url: https://deepsig.atlassian.net/jira/rest/api/2/serverInfo

followed by additional text indicating: X-Seraph-Loginreason': 'AUTHENTICATED_FAILED' within the response headers.

I looked at the Atlassian description here: https://confluence.atlassian.com/display/JIRA050/Creating+Issues+via+direct+HTML+links
which you referenced in your source code (./tcms/issuetracker/types.py) and I was able to manually create a link that works.

For example I could use the following type of link (as specified by Atlassian on their page referenced above) to create a new bug:

https://XXXXXXX.atlassian.net/secure/CreateIssueDetails!init.jspa?pid=PPP&issuetype=TTTT

Here XXXX is our Atlassian instance (we used Cloud version of Jira), PPP is the Jira project ID and TTTT is the Jira issue type ID for bugs. The link worked because I was logged in to my Atlassian account in the same browser.

I don't know why your implementaton did not work. Perhaps Jira implementation changed since you implemented this. Also, it would be very beneficial if you would provide ability for Kiwi TCMS admins to specify/edit Project ID whenever adding/changing new Jira bug tracker and Issue type ID (in our case it was 10004 for bugs). That way we would have more flexibility handling various Jira projects that may not be handling a single product, but multiple products, with potentially separate test plans (all using same Jira project for example). If I understood your documentation you are trying to match Kiwi product name and Jira project name. In some cases a Jira project may handle more than one product.

Version or commit hash (if applicable)

Kiwi TCMS: V12.1
Jira: latest Cloud version

Steps to Reproduce

  1. Try to report a bug from within a test case inside a test execution of a test run
  2. Get a pop-up window named (Report Bug)
  3. Select properly configured and verified Jira Tracker
  4. Click on "Report bug" blue button
  5. You may get an error described above (pop-up window), you must use cloud version of Jira

Actual results

HTTP 404 error

Expected results

New browser tab from Jira that allows user to complete creation of a bug issue in Jira. (it may report that some mandatory fields are not specified and user can complete them) Once mandatory fields are provided (for example, summary and reporter) Jira will create a bug issue.

If Kiwi TCMS provides "reporter" field using First name and Last name of a user Jira may be able to find that same user and may not report reporter field as missing.

Additional info (Python traceback, logs, etc.)

Relevant information provided above. I did not provide full traceback because it may contain private information from Atlassian.

@bkosanovic
Copy link
Author

bkosanovic commented Apr 4, 2023

I was thinking about this problem and it looks like you could implement this for Jira in perhaps simple way without requiring API token for Jira (which is not convenient since Jira only provides personal tokens) by generating proper link for the particular Jira project (based on project ID provided by Kiwi TCMS admin when creating Jira tracker or by matching as you do now) and having user of Kiwi TCMS just click on a button that will have such link. That would require you to have proper project ID and correct issue ID (for bugs). Issue ID's may not be the same for all Jira users since Jira allows considerable customizations. By letting people specify project ID and issue ID to use, your bug trackers configuration for Jira would be trivial and you would just need to provided a proper link behind a button that user needs to click on. The link behind the button would depend on the selected Jira bug tracker for that particular Jira project.

Just a thought.

@atodorov
Copy link
Member

I added JIRA Change Bug Tracker as described in the documentation and I verified with the Configuration health check that configuration is OK and that I can use a Bug URL from our JIRA project to verify Kiwi TCMS can access it.

Can you provide a screenshot of the successful health-check? The error message below says "Authentication failed" which seems to be the root cause of the problem.

However, when I tried to create a bug from within a test case inside a test execution by clicking on "Report bug" from drop down menu at the right top side of the expanded view of the test case that is being executed, I've got a pop up with this:

Internal error: JiraError HTTP 404 url: https://deepsig.atlassian.net/jira/rest/api/2/serverInfo

followed by additional text indicating: X-Seraph-Loginreason': 'AUTHENTICATED_FAILED' within the response headers.

@bkosanovic
Copy link
Author

bkosanovic commented Apr 17, 2023

Well, it seems that the health-check returned "green" but with message that looks like login may not have happened. Here it is:
kiwi

It seems that after seeing red failure messages for a while I assumed green would be OK. 😄 I tried using my firs-last name instead of email, etc. All with the same result. It shows green on verification but does not work when I'm trying to create a bug in Jira from within Kiwi TCMS. I think that Jira is not using "username" any more. They may have tokenized it in some sense since there is no way to get a "username" out of it.

Still, I cannot get this to work at all. However, when I use links with pid= and issueType=, that I mentioned above, I can get Jira to do what needs to be done (assuming I am logged in to it in the same browser window. 🤷‍♂️

This was done with the latest version of Jira Cloud.

@bkosanovic
Copy link
Author

bkosanovic commented Apr 17, 2023

Just as an example, I can make this work with the GitLab:
kiwi-gitlab

But not with Jira 😞 I verified that I can also create a bug in GitLab from within Kiwi TCMS.

@bkosanovic
Copy link
Author

bkosanovic commented Apr 18, 2023

It seems that I have made some progress. I had to use the base URL without jira/ at the end. I think I've got it to work now. Next will be to make sure I can get bugs created in a proper Jira project which right now does not work, but that is a separate problem for me to look at. I will be closing this issue now.

For reference I had to use my e-mail for the username. I also had to use my personal API token for Jira.

Edited: To create bug in a proper project in Jira I had to use the Jira project key for the product name in Kiwi TCMS. Not the project name, but the project key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants