Sometimes, it may be useful to trigger CI jobs directly from Jira and see the results in the test management tool (i.e. Xray).

Currently (as of v3.6), this is not possible out-of-the-box yet. However, with some minor customization, this can already be achieved as depicted in these ScriptRunner-related instructions.

Depending on the use case, this may be quite simple or a little more complex to implement.

Requirements

In order to implement triggering from Xray, and while it is not built-in, you'll need to use an additional Jira app/plugin for that. This app must provide some sort of Jira customization, giving you the ability to add an action (e.g. button) on the UI; besides that, it shall also provide a way of implementing the corresponding code/action that will invoke the CI tool.

Which app to use depends on your context (e.g. existing apps installed in your Jira instance) and the exact use case you aim to implement; depending on that, simpler apps may be used; as a last resource, you may use ScriptRunner even though it requires coding skills.


Possible (tested) apps include:

Other (untested) apps include:

Ultimately, advanced users may prefer to implement a very simple Jira app for this.

Use Cases

Trigger a CI job blindly

In this scenario, we're assuming that:

  • you just want to trigger a CI job, period; this job may be totally unrelated to the issue from where you triggered it
  • what the CI job will do, including if it will report the results back to Xray or not, is not relevant




For most CI tools, this only requires that you perform some HTTP request passing the CI job as an argument, somehow.

"Jenkins integration for Jira", "Automation for Jira", "ScriptRunner" apps can be used to implement this scenario.

Examples

Trigger a CI job and report back to the current issue

In this scenario, we're assuming that:

  • you want to trigger a CI job and report back the results to the current issue (e.g. Test Plan)
  • the tests that will run are unrelated with the caller issue; it's up to the logic built into the CI job to decide which tests to run



"Jenkins Integration for Jira", "Automation for Jira", "ScriptRunner" apps can be used to implement this scenario.

Examples

Trigger a CI job for the selected tests and report back to the current issue


In this scenario, we're assuming that:

  • you want to trigger a CI job and report back the results to the current, caller issue (e.g. Test Plan, Test Execution)
  • the tests that you want to run are the automated ones present in the caller issue (e.g. Test Plan, Test Execution)



This scenario, though feasible, is a bit more complex for two reasons:


  1. because you'll need to pass the information about the tests that you run to the CI tool
  2. the CI job needs to process the previous information and somehow orchestrate test runner; this is highly dependent on the automation framework


"ScriptRunner" app can be used to implement this scenario.

Examples

References