Can we create jira ticket from bitbucket pipeline?
Asked by Joel Stephen:

I need to create a ticket from the pipeline. From the approval of the ticket, we need to trigger the next step. Is it possible? and suggestion, please.


Answers:
author: Patrik S
body: Hello [@Joel Stephen](/t5/user/viewprofilepage/user-id/4911432) ,

Thank you for reaching out to Atlassian Support!

In order to create Jira issues from within your pipeline build, I would suggest using the pipe **jira-create-issue.**Pipe is a simple way to configure your pipeline, especially when integrating with other tools/products, as you usually just have to configure a few variables and the rest is already implemented for you.

Following is an example of using jira-create-issue pipe to create a new Jira issue :

```
script:
  - echo "This is an example step"
  - pipe: atlassian/jira-create-issue:0.2.0
    variables:
      JIRA_BASE_URL: $JIRA_BASE_URL
      JIRA_USER_EMAIL: $JIRA_USER_EMAIL
      JIRA_API_TOKEN: $JIRA_API_TOKEN
      JIRA_PROJECT: "PROJ"
      JIRA_ISSUE_SUMMARY: "This is a sample issue summary"
```

For more examples and details on how this pipe can be configured, you can refer to its public documentation below :

* <https://bitbucket.org/product/features/pipelines/integrations?p=atlassian/jira-create-issue>

In regards to triggering a pipeline after the respective Jira issue is approved, I'm afraid this is currently not possible. However, in case you want some of the steps to require manual intervention to start, you have the option to use **trigger: manual** in your YML file, like the below example :

```
 - step:

     script:

        - npm build

 - step:

        name: Deploy to production

        trigger: manual

        script:

          - ./deploy_production.sh
```

Reference: <https://bitbucket.org/blog/pipelines-manual-steps-confidence-deployment-pipeline>

Hope that helps to clarify your questions. In case you have any doubt, please let me know.

Thank you, [@Joel Stephen](/t5/user/viewprofilepage/user-id/4911432) !

Kind regards,

Patrik S

comments: author: Joel Stephen
body: Thanks [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) for your suggestion.


author: Hudson Luiz Sales Schumaker
body: Hello,

is there a way on this pipeline to retrieve the "TICKET_ NUMBER" generated when the ticket was created ?

thanks in advance.


author: Patrik S
body: Hey [@Hudson Luiz Sales Schumaker](/t5/user/viewprofilepage/user-id/5276116) !

I'm afraid the pipe does not currently return the number of the ticket created. If you want, I can create a feature request for our engineering team to implement this functionality.


author: Hudson Luiz Sales Schumaker
body: sure thing


author: Patrik S
body: Hey [@Hudson Luiz Sales Schumaker](/t5/user/viewprofilepage/user-id/5276116)

I've just raised a feature request for it, which you can access at the following link :

* <https://jira.atlassian.com/browse/BCLOUD-22799>

We encourage you to add your **Vote** there and also mark yourself as a **Watcher**to receive first-hand updates whenever there's any progress on the implementation of that feature.

Thank you, [@Hudson Luiz Sales Schumaker](/t5/user/viewprofilepage/user-id/5276116) !

Patrik S


Tags: bitbucket-cloud

cloud