Ever wanted to get build and deployment links directly in Jira? Now you can, just add this small step to the last stage of your pipeline and get all the relevant information right in the ticket details page.

Builds Panel Preview

Generate Credentials for OAuth App

Generate new OAuth Credentials and copy

See: https://support.atlassian.com/jira-cloud-administration/docs/integrate-with-self-hosted-tools-using-oauth/

OAuth Creds Screen

Use with Any CI/CD Provider

As long as your CI/CD provider supports running Docker images you may use this integration. Tested in Drone.io, Gitlab CI, and Google Cloud Build.

Docker Images are available from:

Pick whatever you want and is convenient for you.

Configuration is through Environment Variables. Read more in the repository Readme.

Jira Drone.io Example

Build Status

Add secrets for JIRA_CLIENT_ID and JIRA_CLIENT_SECRET and then add this to your pipeline:

steps:
  - name: jira-integration
    image: boringdownload/jira-integration:v0
    environment:
      BUILD_NAME: drone-pipeline
      JIRA_INSTANCE: companyname
      JIRA_CLIENT_ID:
        from_secret: jira_client_id
      JIRA_CLIENT_SECRET:
        from_secret: jira_client_secret

Jira Gitlab CI/CD

pipeline status

Add a CI/CD Variable to your project for JIRA_CLIENT_ID and JIRA_CLIENT_SECRET (remember to mask them) and then add these steps to your pipeline (we use .post stage so it runs last)

jira-integration-on-success:
  stage: .post
  when: on_success
  image: registry.gitlab.com/rohit-gohri/jira-ci-cd-integration:v0
  script: jira-integration
  variables:
    BUILD_STATE: successful
    BUILD_NAME: gitlab-pipeline
    JIRA_INSTANCE: companyname

jira-integration-on-failure:
  extends: jira-integration-on-success
  when: on_failure
  variables:
    BUILD_STATE: failure

Usage With Github Actions

You can also use this as a Github Action if you want to send release information to Jira.

test-release workflow

First add OAuth Creds as secrets to Github (See: https://docs.github.com/en/actions/reference/encrypted-secrets)

  • Add Client ID as JIRA_CLIENT_ID
  • Add Client Secret as JIRA_CLIENT_SECRET

Github Secrets

Use in Builds Pipeline

- name: Jira Integration
  if: ${{ always() }}
  uses: rohit-gohri/jira-ci-cd-integration@v0
  with:
    event_type: build
    state: ${{ job.status }}
    jira_instance: companyname # Subdomain for Jira Cloud
    client_id: ${{ secrets.JIRA_CLIENT_ID }}
    client_secret: ${{ secrets.JIRA_CLIENT_SECRET }}

Use in Deployment Pipeline

- name: Jira Integration
  if: ${{ always() }}
  uses: rohit-gohri/jira-ci-cd-integration@v0
  with:
    event_type: deployment
    state: ${{ job.status }}
    issue: JCI-3, JCI-6 # Comma separated list of issues being deployed/released. You are expected to generate this yourself in a previous step
    jira_instance: companyname # Subdomain for Jira Cloud
    client_id: ${{ secrets.JIRA_CLIENT_ID }}
    client_secret: ${{ secrets.JIRA_CLIENT_SECRET }}

Result

That's all it takes. You'll get Builds information like you do for Branches and Pull Requests:

result

Source

You can find the source on Github:

jira-ci-cd-integration