> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/jira

Connect your CircleCI pipelines to Jira. Define builds and deployments as config and automatically update Jira issues with the results of your pipelines.


## Commands

### notify

Send a notification to Jira for a build or deployment.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `debug` | boolean | false | Enable additional logging if you are running into issues. A log will be generated at '/tmp/circleci_jira.log'. |
| `environment` | string | ${CIRCLE_JOB} | For deployments. Indicates the name of target environment. By default the name of the CircleCI Job is used. |
| `environment_type` | enum | development | Indicates the category of target environment as defined by Atlassian |
| `ignore_errors` | boolean | true | Ignore errors. Errors posting to Atlassian will not result in failed builds unless disabled. |
| `issue_regexp` | string | ([A-Z]{2,30}-[0-9]+) | Override the default project key regexp if your project keys follow a different format. Your key must be in the [1] capture group. |
| `job_type` | enum | build | Indicates if job should be treated as build or deployment in Jira dev panel. Note that Deployments require additional details. |
| `oidc_token` | string | ${CIRCLE_OIDC_TOKEN_V2} | Customize the OpenID Connect token used to authenticate with Jira. This most often will not need to be changed. |
| `pipeline_id` | string |  | Pass in the pipeline id via CircleCI pipeline parameters. This must be specified manually. Refer to usage example. |
| `pipeline_number` | integer |  | Pass in the pipeline number via CircleCI pipeline parameters. This must be specified manually. Refer to usage example. |
| `service_id` | string | ${JIRA_SERVICE_ID} | Specify the JSD service ID for the project this notification targets. This will be sent with deployment notifications. |
| `webhook_url` | string | ${JIRA_WEBHOOK_URL} | Get your webhook URL from the management panel in the CircleCI for Jira app in Atlassian. |

## Examples

### send_build_notification

Send build notifications to Jira as a part of your CI config. Add the notify command as the last step of your job. By default, the branch name will be used to identify the Jira issue. A 'JIRA_WEBHOOK_URL' environment variable must be provided.


```yaml
version: '2.1'
orbs:
  jira: circleci/jira@2.0
  node: circleci/node@5.1
jobs:
  build:
    executor: node/default
    steps:
      - checkout
      - node/install-packages
      - run:
          command: npm test
          name: Test app
      - jira/notify:
          pipeline_id: << pipeline.id >>
          pipeline_number: << pipeline.number >>
workflows:
  build-workflow:
    jobs:
      - build:
          context: JIRA_WEBHOOK
```

### send_pipelines_to_jira

Send pipeline job statuses to Jira as a part of your CI config. A 'JIRA_WEBHOOK_URL' environment variable must be provided.


```yaml
version: '2.1'
orbs:
  jira: circleci/jira@2.0
  node: circleci/node@5.1
jobs:
  build:
    executor: node/default
    steps:
      - checkout
      - node/install-packages
      - run:
          command: npm test
          name: Run tests
      - jira/notify:
          pipeline_id: << pipeline.id >>
          pipeline_number: << pipeline.number >>
  deploy:
    executor: node/default
    steps:
      - checkout
      - node/install-packages
      - run:
          command: npm run deploy
          name: Run Deployment
      - jira/notify:
          environment: staging
          environment_type: staging
          job_type: deployment
          pipeline_id: << pipeline.id >>
          pipeline_number: << pipeline.number >>
          service_id: 123456
workflows:
  main:
    jobs:
      - build:
          context: JIRA_WEBHOOK
          filters:
            tags:
              only: /.*/
      - deploy:
          context: JIRA_WEBHOOK
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^v.*/
          requires:
            - build
```