Git Product home page Git Product logo

jira-resource's Introduction

Jira Ticket Resource

Create and update Jira tickets via Concourse

Quick Example

- name: update-jira
  plan:
  - put: jira
    params:
      issue_type: Change
      summary: Build v1.0.1
      fields:
        description: With some text

Source Configuration

resources:
- name: jira
  type: jira-resource
  source:
    url: https://xxxxx.atlassian.net
    username: xxxxx
    password: xxxxx
    project: APROJECT

Resource Type Configuration

resource_types:
- name: jira-resource
  type: docker-image
  source:
    repository: danrspencer/jira-resource
    tag: latest

Behavior

out: Creates, updates and transitions a Jira ticket

$TEXT

The summary, fields and custom_fields can be either a string value, or an object with text / file fields. If just the file is specified it is used to populate the field, if both file and text are specified then the file is substituted in to replace $FILE in the text.

e.g.

description: An awesome ticket
-------
description:
  file: messages/this-will-be-the-description
-------
description:
  text: |
    Substitute text into this messaage
        
    $TEXT
  file: messages/jira-message

$NOW

If a date field needs to be populated with a date relative to current time $NOW can be used. The datetime can be modified relative to the current date.

e.g.

$NOW
# One hour ahead
$NOW+1h
# Yesterday
$NOW-1d

KEY

  • years y
  • weeks w
  • days d
  • hours h
  • minutes m
  • seconds s

Parameters

  • summary: required The summary of the Jira Ticket. This is used as a unique identifier for the ticket for the purpose of updating / modifying. As such it's recommended you include something unique in the summary, such as the build version.
summary: Ticket Summary
-------
summary:
  text: Build v$FILE
  file: version/version
  • issue_type: The issue type for the ticket
issue_type: Bug
  • fields: A list of fields to be set with specified values
fields:
  description:
    text: |
      Routine Release
            
      $FILE
    file: messages/jira-release-notes
  environment: Prod
  duedate: $NOW+1h
  • custom_fields: A list of custom fields to update. The id and value are used to update the custom field. The property title doesn't matter, it's purpose is to make the pipeline yml more understandable.
custom_fields:
  this_text_doesnt_matter:
    id: 10201
    value: Something
  • watchers: An array of usernames to be added as watchers to the ticket
watchers:
  - dave
  - amier
  - lauren
  • transitions: An array of string values for the ticket to be moved though. The transitions are conducted in the order specified.
transitions:
  - Submit
  - In Dev

Order of execution

When executing the Jira job the ticket is updated in the following order:

  • Search for existing issue matching summary given
  • Create ticket / update ticket
  • Add watchers
  • Perform transitions

If you need to perform actions in a different order, for example, transitions before adding watchers then multiple jobs are required.

e.g.

# Create ticket and Submit
- put: jira
  params:
    issue_type: Change
    summary:
      text: Site v$FILE
      file: version/version
    transitions:
       - Submit
# Add a watcher then move to in dev
- put: jira
  params:
    summary:
      text: Site v$FILE
      file: version/version
    watchers:
    - dan
    transitions:
    - In Dev

Real world example

jobs:
- name: start-release
  plan:
  - get: code-base
    trigger: true
  - get: version
  - task: write-release-notes
    config:
      platform: linux
      image_resource:
        source:
          repository: travix/base-alpine-git
        type: docker-image
      inputs:
      - name: version
      - name: code-base
      run:
        path: code-base/ci/scripts/write-release-notes
      outputs:
      - name: messages
  - put: jira
    params:
      issue_type: Change
      summary:
        text: Build v$FILE
        file: version/version
      fields:
        description:
          text: |
            Routine Release

            $FILE

            _Generated by Concourse_
          file: messages/jira-release-notes
        environment: Prod
        duedate: $NOW+1h
      custom_fields:
        how_awesome:
          id: 10201
          value: Very!
      transitions:
      - Submit
  - put: jira
    params:
      summary:
        text: Build v$FILE
        file: version/version
      watchers:
      - dave
      - amier
      - lauren
      transitions:
      - Approve

resources:
- name: code-base
  type: git
  source:
    uri: [email protected]:danrspencer/jira-resource.git
    branch: master
    private_key: {{private-repo-key}}
      
- name: version
  type: semver
  source:
    driver: git
    uri: [email protected]:danrspencer/jira-resource.git
    branch: version
    private_key: {{private-repo-key}}
    file: version
      
- name: jira
  type: jira-resource
  source:
    url: https://jira.atlassian.net
    username: {{jira-username}}
    password: {{jira-password}}
    project: JR

resource_types:
- name: jira-resource
  type: docker-image
  source:
    repository: danrspencer/jira-resource
    tag: latest

jira-resource's People

Contributors

danrspencer avatar

Watchers

Craig Bookwalter avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.