Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
134.7K

Jira Issue Manager jira-issue-manager

Create, Update, & Validate Jira Issues

arguments

  • ACTION - Specifies the type of action to perform against your Jira instance - please see the examples and readme
  • COMMENT_BODY - Text to add to the comment
  • DESIRED_ISSUE_STATUS - Desired state of jira issue: Approved, Backlog
  • ISSUE_COMPONENTS - List of components using comma separated values: backend,database
  • ISSUE_CUSTOMFIELDS - Custom fields to pass to JIRA Issue Creation. Key=Value format.
  • ISSUE_DESCRIPTION - Jira issue description
  • ISSUE_PROJECT - Jira project key: necessary for issue creation
  • ISSUE_SUMMARY - Jira issue summary (main title)
  • ISSUE_TYPE - Jira issue type: Task, Bug, etc
  • JIRA_API_KEY - Jira API key
  • JIRA_BASE_URL - Jira base url
  • JIRA_COMMENT_ID - Jira comment ID to update a comment
  • JIRA_ISSUE_SOURCE_FIELD - Jira issue ID or key source field
  • JIRA_ISSUE_SOURCE_FIELD_REGEX - Regex expression to get the Jira issue info from the JIRA_ISSUE_SOURCE_FIELD
  • JIRA_SERVER_PAT - Jira Personal Access Token for Jira Server
  • JIRA_USERNAME - Jira username or email
  • JQL_QUERY - Free form query - please see Jira advanced search details
  • JQL_QUERY_MAX_RESULTS - Allows you to specify the number of results that can return from a jql query
  • VERBOSE - Enable verbose logging by setting to true
    JiraCommentCreate:
  title: Add Jira Comment
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    JIRA_ISSUE_SOURCE_FIELD: '${{JIRA_ISSUE_SOURCE_FIELD}}'
    ACTION: comment_create
    COMMENT_BODY: Test from codefresh pipeline

  
    JiraCommentUpdate:
  title: Update Jira Comment
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    JIRA_ISSUE_SOURCE_FIELD: '${{JIRA_ISSUE_SOURCE_FIELD}}'
    ACTION: comment_update
    JIRA_COMMENT_ID: '33455'
    COMMENT_BODY: New Updating from codefresh pipeline

  
    JiraIssueCreate:
  title: Add Jira Issue
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    ACTION: issue_create
    ISSUE_PROJECT: SA
    ISSUE_SUMMARY: Brandons test 4
    ISSUE_DESCRIPTION: Description inserted from codefresh pipeline
    ISSUE_COMPONENTS: 'step,pov'
    ISSUE_CUSTOMFIELDS:
      - MY FIELD1=MYVALUE1
      - customfield_10067=MYVALUE2
    ISSUE_TYPE: Task

  
    JiraIssueUpdate:
  title: Update Jira Issue
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    JIRA_ISSUE_SOURCE_FIELD: '${{JIRA_ISSUE_SOURCE_FIELD}}'
    ACTION: issue_update
    ISSUE_SUMMARY: Brandons test 3.1
    ISSUE_DESCRIPTION: Description updated from codefresh pipeline
    ISSUE_COMPONENTS: step
    ISSUE_TYPE: Task

  
    JiraIssueUpdateAllFromJQL:
  title: Update Jira Issues From JQL Query
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    ACTION: update_all_from_jql_query
    ISSUE_DESCRIPTION: Update from JQL Query
    ISSUE_COMPONENTS: 'step,pov'
    ISSUE_TYPE: Task
    JQL_QUERY: project=SA and summary~"Brandons testing*" and assignee = currentUser()
    JQL_QUERY_MAX_RESULTS: '50'

  
    JiraIssueVerifyStatus:
  title: Verify Issue Status on Single Issue
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    JIRA_ISSUE_SOURCE_FIELD: '${{JIRA_ISSUE_SOURCE_FIELD}}'
    ACTION: verify_status
    DESIRED_ISSUE_STATUS: Blocked

  
    JiraIssueVerifyStatusAllFromJQL:
  title: Verify Issue Status on Issues from JQL Query
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    ACTION: verify_status
    DESIRED_ISSUE_STATUS: Blocked
    JQL_QUERY: project=SA and summary~"Brandons testing*" and assignee = currentUser()

  
    JiraIssueTransitionStatus:
  title: Transition the Issue status on a single item
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    JIRA_ISSUE_SOURCE_FIELD: '${{JIRA_ISSUE_SOURCE_FIELD}}'
    ACTION: issue_transition
    DESIRED_ISSUE_STATUS: Blocked
    VERBOSE: true

  
    JiraIssueTransitionStatusAndUpdate:
  title: Transition the Issue status and update a single item
  type: jira-issue-manager
  arguments:
    JIRA_BASE_URL: 'https://company-name.atlassian.net/'
    JIRA_USERNAME: '${{JIRA_USERNAME}}'
    JIRA_API_KEY: '${{JIRA_API_KEY}}'
    JIRA_ISSUE_SOURCE_FIELD: '${{JIRA_ISSUE_SOURCE_FIELD}}'
    ACTION: issue_transition_and_update
    DESIRED_ISSUE_STATUS: Blocked
    ISSUE_DESCRIPTION: Updated while transitioning status
    VERBOSE: true

  
github.com
Brandon Phillips
Mar 21, 2023