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

Issues not transitioned to status when using Jira Server #389

Closed
3 tasks done
aufdenpunkt opened this issue Oct 15, 2024 · 9 comments
Closed
3 tasks done

Issues not transitioned to status when using Jira Server #389

aufdenpunkt opened this issue Oct 15, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@aufdenpunkt
Copy link

aufdenpunkt commented Oct 15, 2024

Description

Hi,

This is actually not a bug in your really nice plugin. We noticed that it is not possible to set the status/transition via the Jira Server REST API, when the issue POST endpoint is used.

...
      await configureXrayPlugin(fixedOn, config, {
        jira: {
          projectKey: 'TTEST',
          url: 'server url',
          testExecutionIssue: {
            transition: {
              id: '6',
            },
          },
        },
      });
...

Unfortunately, when it comes to transitions, the Jira Server and Jira Cloud REST APIs work slightly differently. See https://jira.atlassian.com/browse/JRASERVER-66881

Is it possible to implement some kind of "hooks" that can be used to make another request to the API per issue, e.g. to call an additional endpoint to set the status?

Thanks and best,
Chris

Cypress version

13.14.2

Plugin version

7.3.0

Jira/Xray type

Server

Configuration

No response

Acknowledgements

  • I have made sure not to include any sensitive data in screenshots or obfuscated all occurrences.
  • I have made sure not to include any sensitive data in descriptions or replaced all values with placeholders.
  • I have made sure not to include any sensitive data in code snippets or replaced all values with placeholders.
@aufdenpunkt aufdenpunkt added the bug Something isn't working label Oct 15, 2024
@csvtuda
Copy link
Contributor

csvtuda commented Oct 15, 2024

Hi @aufdenpunkt,

interesting, I've never actually used the transition property.

Is it possible to implement some kind of "hooks" that can be used to make another request to the API per issue, e.g. to call an additional endpoint to set the status?

This would work, yes. Maybe something like:

await configureXrayPlugin(fixedOn, config, {
  jira: {
    projectKey: 'TTEST',
    url: 'server url',
    onResultUpload: ({issue, jiraClient, xrayClient }) => {
      // call transition issue endpoint yourself here
      jiraClient.transitionIssue(issue.key, "done");
    }
  },
});

I could optionally make the clients my plugin uses available there, too. Some of the endpoints there could maybe be reused.


Alternatively, I can also implement a transition detection and perform transition calls in the plugin, too. Shouldn't be too difficult.

Let me know what you think.

@csvtuda csvtuda added feature New feature or request bug Something isn't working under investigation The issue is being investigated and removed bug Something isn't working labels Oct 15, 2024
@csvtuda csvtuda self-assigned this Oct 16, 2024
@aufdenpunkt
Copy link
Author

Hi @csvtuda,

thanks for your quick response. So, basically, having hooks would enable a certain flexibility. But, as this is more an edge case in my opinion, I would prefer the transition detecktion.

@csvtuda csvtuda added 🏗 in progress The issue is being worked on and removed under investigation The issue is being investigated feature New feature or request labels Oct 16, 2024
@csvtuda
Copy link
Contributor

csvtuda commented Oct 23, 2024

A quick update: I have not been able to work on this yet. I'll probably implement it this weekend, there's a lot of other stuff going on at the moment.

@aufdenpunkt
Copy link
Author

Don't worry and thanks for the update. Let me know if I can support you in any way or can contribute.
Have a great weekend.

@csvtuda
Copy link
Contributor

csvtuda commented Oct 27, 2024

Hi @aufdenpunkt,

I have released version 7.4.0, which now explicitly performs the transition iff:

  • a transition is specified in jira.testExecutionIssue.transition
  • no existing test execution issue is reused via jira.testExecutionIssue.key or the deprecated jira.testExecutionIssueKey (as the bug only affects new issues)
  • Jira server is used

The code from your example should hopefully work now. Let me know if it does!

@csvtuda csvtuda added awaiting feedback The issue has been addressed and the reporter's feedback is requested and removed 🏗 in progress The issue is being worked on labels Oct 27, 2024
@aufdenpunkt
Copy link
Author

Hi @csvtuda,

Sorry for my late response, and thanks for the release! I will have a look in the upcoming days.

@aufdenpunkt
Copy link
Author

Hi @csvtuda,

It is working now, thank you very much. 🙂

During my testing, I stepped into a minor bug. Setting the transition ID as a property inside the transition object, like in my example configuration above, leads to a 400 Bad request. After some debugging, I've figured out that the request has been made with the body { "id": "123" }. But the body needs to be like { "transition": { "id": "123" } }. I was able to fix it using a workaround, wrapping it into another transition object like so:

...
      await configureXrayPlugin(fixedOn, config, {
        jira: {
          projectKey: 'TTEST',
          url: 'server url',
          testExecutionIssue: {
            transition: {
              transition: {
                id: '6',
              },
            },
          },
        },
      });
...

@csvtuda
Copy link
Contributor

csvtuda commented Oct 31, 2024

Oops, sorry! Fixed in 7.4.1.


Unfortunately, I cannot write a proper integration test for this feature because:

  • my Jira cloud instance is obviously not affected by it
  • the Jira server instance provided by Xray (🙏) does not allow such manual transitions (all automated/workflow-based)

Thanks for trying it out and reporting this oversight.

@aufdenpunkt
Copy link
Author

That was quick, thanks! 🙏

Then, from my side, it's all fine now.

@csvtuda csvtuda removed the awaiting feedback The issue has been addressed and the reporter's feedback is requested label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants