---
title: "[Xray Cloud] Triggering automation from Xray"
canonical: "https://docs.getxray.app/space/ProductKB/46268894/%5BXray%20Cloud%5D%20Triggering%20automation%20from%20Xray"
format: markdown
---
<span style="color: #000000">Sometimes, it may be useful to trigger CI jobs directly from Jira and see the results in the test management tool (i.e. Xray).</span>

<span style="color: #000000">Currently (as of August 2020), this is not provided directly by Xray yet. However, with some minor customization, this can easily be achieved</span><span style="color: #000000">.</span>

<span style="color: #000000">Depending on the use case, this may be quite simple or a little more complex to implement.</span>

# <span style="color: #000000">Requirements</span>

<span style="color: #000000">In order to implement triggering from Xray, and while it is not built-in, you'll need to either use Jira Cloud automation capabilities or use an additional Jira app/plugin for that. If using an external app, it 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.</span>

<span style="color: #000000">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 Power Scripts or ScriptRunner even though it requires coding skills.</span>


> ℹ️ **Please note**
> ℹ️ 
> ℹ️ As Jira Cloud now includes automation capabilities (i.e. with the recent acquisition of Automation for Jira app), this may be the most straightforward approach to trigger (manually or automatically) builds in the CI/CD tool.



<span style="color: #000000">Possible (tested) solutions include:</span>

- <span style="color: #000000">using the </span>[<span style="color: #000000">built-in automation capabilities of Jira Cloud,</span>](https://support.atlassian.com/jira-software-cloud/docs/automate-your-jira-cloud-processes-and-workflows/)<span style="color: #000000"> formerly also known as "Automation for Jira" app (has a broader scope than "Jenkins integration for Jira" app but may be used to implement some simple scenarios)</span>

<span style="color: #000000">Other (</span><u><span style="color: #000000">untested</span></u><span style="color: #000000">) apps include:</span>

- [<span style="color: #000000">Jenkins Integration for Jira</span>](https://marketplace.atlassian.com/apps/1211376/jenkins-integration-for-jira?hosting=cloud&tab=overview)<span style="color: #000000">  (simpler and focused on Jenkins, seems to work)</span>
- [<span style="color: #000000">PowerScripts</span>](https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=server&tab=overview)
- <span style="color: #000000">ScriptRunner (more complex though)</span>

# <span style="color: #000000">Use Cases</span>

## <span style="color: #000000">Trigger a CI job blindly</span>

<span style="color: #000000">In this scenario, we're assuming that:</span>

- <span style="color: #000000">you just want to trigger a CI job, period; this job may be totally unrelated to the issue from where you triggered it</span>
- what the CI job will do, including if it will report the results back to Xray or not, is not relevant


![image](media://bfb24837-c100-4056-bbc7-d9e16ffa5fbc)



<span style="color: #000000">For most CI tools, this only requires that you perform some HTTP request passing the CI job as an argument, somehow.</span>

## <span style="color: #000000">Examples</span>

- [<span style="color: #172b4d">Examples using Jira Cloud's built-in automation capabilities</span>](https://getxraydocs.atlassian.net/wiki/display/XRAYCLOUD/Taking+advantage+of+Jira+Cloud+built-in+automation+capabilities)

## <span style="color: #000000">Trigger a CI job and report back to the current issue</span>

<span style="color: #000000">In this scenario, we're assuming that:</span>

- <span style="color: #000000">you want to trigger a CI job and report back the results to the current issue (e.g. Test Plan)</span>
- <span style="color: #000000">the tests that will run are</span><span style="color: #000000"> </span><u><span style="color: #000000">unrelated</span></u><span style="color: #000000"> </span><span style="color: #000000">with the caller issue; it's up to the logic built into the CI job to decide which tests to run</span>


![image](media://422added-0432-4a9f-94ac-478e7e29d15f)

## <span style="color: #000000">Examples</span>

- [<span style="color: #172b4d">Examples using Jira Cloud's built-in automation capabilities</span>](https://getxraydocs.atlassian.net/wiki/display/XRAYCLOUD/Taking+advantage+of+Jira+Cloud+built-in+automation+capabilities)

## <span style="color: #000000">Trigger a CI job for the selected tests and report back to the current issue</span>

<span style="color: #000000">In this scenario, we're assuming that:</span>

- <span style="color: #000000">you want to trigger a CI job and report back the results to the current, caller issue (e.g. Test Plan, Test Execution)</span>
- <span style="color: #000000">the tests that you want to run are the automated ones present in the caller issue (e.g. Test Plan, Test Execution)</span>


![image](media://1ba55a91-0feb-4114-8007-d7ffe6f62436)


<span style="color: #000000">This scenario is a bit more complex for two reasons:</span>

1. <span style="color: #000000">because you'll need to pass the information about the tests that you run to the CI tool</span>
2. <span style="color: #000000">the CI job needs to process the previous information and somehow orchestrate test runner; this is highly dependent on the automation framework</span>

There is no straightforward approach to implement this.

# <span style="color: #000000">References</span>

- [<span style="color: #000000">Automation for Jira documentation on Jira Cloud</span>](https://support.atlassian.com/jira-software-cloud/docs/automate-your-jira-cloud-processes-and-workflows/)