Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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


 Bamboo configuration

No special configuration needs to be done in Bamboo.

Automation configuration

  1. create a new rule and define the "When" (i.e. when it to should be triggered), to be "Manually triggered"

Image Removed

2. define an action (i.e. the "Then") as "Send webhook" and configure it as follows

Image Removed

  • the Webhook URL provided above follows this syntax:
    • <bamboo_base_url>/rest/api/latest/queue/${projectKey}-${planKey}
  • the Webhook HTTP POST body content, defined in the "Custom data" field, will be used to identify the stages to run and other parameters

    Code Block
    languagejs
    titlecustom data (i.e. HTTP body content)
    collapsetrue
    default&ExecuteAllStages=true
  • besides the "Content-Type" header that should be "application/x-www-form-urlencoded", define also an "Authorization" header having the value "Basic <auth>", where  the base64 encoded <auth> can be generated using your Bamboo credentials

After publishing the rule, you can go to the screen of an issue and trigger the Bamboo plan build.

Image Removed

In this case, since Bamboo was configured to report results back to Xray, a new Test Execution would be created in Jira/Xray.

Image Removed

Trigger a Bamboo plan build from a Test Plan and report the results back to it

In this simple scenario, we'll implement a rule, triggered manually, that will trigger a Bamboo's plan build. The action will be available from the "Automation" panel, for all Test Plan issues of the selected project.

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
  • the results will be submitted back to Xray, if the project is configured to do so in Bamboo

Bamboo configuration

The project itself is a normal one; the only thing relevant to mention is that this project is a parameterized one, so it receives a TESTPLAN variable, that in our case will be coming from Jira.

Image RemovedIn a Bamboo Plan Configuration we will use the Script task to import the results back to Xray. We have defined internal Bamboo variables for the CLIENT_ID, CLIENT_SECRET, that are required for authentication and the TESTPLAN to associate on the Xray side.

Image Added

Code Block
languagebash
collapsetrue
token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "${bamboo.CLIENT_ID}","client_secret": "${bamboo.CLIENT_SECRET}" }' https://xray.cloud.getxray.app/api/v1/authenticate| tr -d '"');
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token"  --data @"/home/jira/bamboo-home/xml-data/build-dir/XRAY-JAV-JOB1/java-junit-Bookstore/target/surefire-reports/TEST-com.xpand.java.BookstoreTest.xml" https://xray.cloud.getxray.app/api/v1/import/execution/junit?projectKey=XT&testPlanKey=${bamboo.TESTPLAN}


Automation configuration

  1. create a new rule and define the "When" (i.e. when it to should be triggered), to be "Manually triggered"

Image Added

2. define an action (i.e. the "Then") as "Send webhook" and configure it as follows

Image Added

  • the Webhook URL provided above follows this syntax:
    • <bamboo_base_url>/rest/api/latest/queue/${projectKey}-${planKey}
  • the Webhook HTTP POST body content, defined in the "Custom data" field, will be used to identify the stages to run and other parameters

    Code Block
    languagejs
    titlecustom data (i.e. HTTP body content)
    collapsetrue
    default&ExecuteAllStages=true
  • besides the "Content-Type" header that should be "application/x-www-form-urlencoded", define also an "Authorization" header having the value "Basic <auth>", where  the base64 encoded <auth> can be generated using your Bamboo credentials


After publishing the rule, you can go to the screen of an issue and trigger the Bamboo plan build.

Image Added


In this case, since Bamboo was configured to report results back to Xray, a new Test Execution would be created in Jira/Xray.

Image Added

Trigger a Bamboo plan build from a Test Plan and report the results back to it

In this simple scenario, we'll implement a rule, triggered manually, that will trigger a Bamboo's plan build. The action will be available from the "Automation" panel, for all Test Plan issues of the selected project.

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
  • the results will be submitted back to Xray, if the project is configured to do so in Bamboo


Bamboo configuration

The project itself is a normal one; the only two things relevant to mention are:

  • that this project is a parameterized one, so it receives a TESTPLAN variable, that in our case will be coming from Jira and that we have added a step to import the results back to Xray.

Image Added

  • For authentication we use internal Bamboo variables to define the CLIENT_ID, CLIENT_SECRET and the TESTPLAN to associate on the Xray side.

Image Added

Code Block
languagebash
collapsetrue
token=$(curl -H "Content-Type: application/json" -X POST --data '{ "client_id": "${bamboo.CLIENT_ID}","client_secret": "${bamboo.CLIENT_SECRET}" }' https://xray.cloud.getxray.app/api/v1/authenticate| tr -d '"');
curl -H "Content-Type: text/xml" -X POST -H "Authorization: Bearer $token"  --data @"/home/jira/bamboo-home/xml-data/build-dir/XRAY-JAV-JOB1/java-junit-Bookstore/target/surefire-reports/TEST-com.xpand.java.BookstoreTest.xml" https://xray.cloud.getxray.app/api/v1/import/execution/junit?projectKey=XT&testPlanKey=${bamboo.TESTPLAN}


Automation configuration

  1. create a new rule and define the "When" (i.e. when it to should be triggered ), to be "Manually triggered"

...

  • the Webhook URL provided above follows this syntax:
    • <bamboo_base_url>/rest/api/latest/queue/${projectKey}-${planKey}
  • the Webhook HTTP POST body content, defined in the "Custom data" field, will be used to identify the stages to run and other parameters

    Code Block
    languagejs
    titlecustom data (i.e. HTTP body content)
    collapsetrue
    default&ExecuteAllStages=true&bamboo.TESTPLAN={{issue.key}}
  • besides the "Content-Type" header that should be "application/x-www-form-urlencoded", define also an "Authorization" header having the value "Basic <auth>", where  the base64 encoded <auth> can be generated using your Jenkins API Bamboo credentials


After publishing the rule, you can go to the screen of an issue and trigger the Bamboo plan.

...