Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    coryb
    @coryb
    Uhh, that is an odd photo, it goes to: https://github.com/tidwall/gjson#path-syntax
    it is a functional replacement for jq
    but written in golang so I can embed it in jira
    Ramon Buckland
    @rbuckland
    funny odd photo :-)
    Here is my full config.yml
    #
    #
    
    endpoint: https://myjira.internal
    # A new version is coming which will support a VARIABLE .. {{env.SOMETHING}}
    # user: ${USER}
    password-source: keyring
    project: MYPROJ
    project_board: My Project - Scrum
    #
    # This must be a full path - the shell escaping doesn't resolve ~
    #
    project_dir: /Users/user/projects/_jira_issues
    # editor: {{env.VISUAL}}
    
    queryfields: summary,created,updated,priority,status,reporter,assignee,labels,issuetype
    
    custom-commands:
      - name: env
        help: print the JIRA environment variables available to custom commands
        script: |
          env | grep JIRA
    
      - name: mine
        help: display issues assigned to me
        script: |-
          # An alternative - {{jira}} list --query "resolution = unresolved and assignee=currentuser() ORDER BY created"
          {{jira}} list --query "assignee = currentUser() AND sprint IN openSprints() ORDER BY rank ASC"
    
      - name: all
        help: Show all issues in a project, regardless of state (open, closed etc)
        script: |-
          {{jira}} list --query "project = ${JIRA_PROJECT} ORDER BY rank ASC"
    
      - name: slurp
        help: Makes a directory in <project_dir>/<ISSUE> and slurps a "local" version of the issue (yml, json), including attachments.
        args:
          - name: ISSUE
            required: true
        script: |-
          thedir=${JIRA_PROJECT_DIR}/{{args.ISSUE}}
          echo ":: Pulling {{args.ISSUE}} to ${thedir}"
          mkdir -p ${thedir}
          {{jira}} view {{args.ISSUE}} -t debug > ${thedir}/{{args.ISSUE}}.json
          {{jira}} view {{args.ISSUE}} > ${thedir}/{{args.ISSUE}}.yml
          ( cd ${thedir} && {{jira}} attach list -t debug {{args.ISSUE}}  | jq -r '.[] | (.id | tostring)  + " " + .filename' | xargs -L1 sh -c '{{jira}} attach get $0 -o $1' )
    
      #
      # Sprint and Epic Related
      #
    
      - name: add2sprint
        help: Add the issue to the current sprint.
        args:
          - name: ISSUE
            required: true
        script: |-
          board_name=$( echo ${JIRA_PROJECT_BOARD} | python -c 'import sys,urllib;print urllib.quote(sys.stdin.read().strip())' )
          board_id=$( {{jira}} request -M GET "/rest/agile/1.0/board?name=${board_name}" | jq '.values[0].id' )
          sprint_id=$( {{jira}} request -M GET "/rest/agile/1.0/board/${board_id}/sprint?state=active" | jq '.values[0].id' )
          {{jira}} request -M POST /rest/agile/1.0/sprint/${sprint_id}/issue "{\"issues\":[ \"{{args.ISSUE}}\" ]}"
    
      - name: insprint
        help: Show all open issues in this sprint.
        script: |-
          {{jira}} list --query "project = ${JIRA_PROJECT} AND sprint IN openSprints() AND resolution IS EMPTY ORDER BY rank ASC"
    
      - name: insprint-closed
        help: Show all closed issues in this sprint.
        script: |-
          {{jira}} list --query "project = ${JIRA_PROJECT} AND sprint IN openSprints() AND resolution IS NOT EMPTY ORDER BY rank ASC"
    
      - name: inbacklog
        help: Show the backlog (open issues, not in sprint)
        script: |-
          {{jira}} list --query "project = ${JIRA_PROJECT} AND ( sprint NOT IN openSprints() OR sprint IS EMPTY ) AND resolution IS EMPTY ORDER BY rank ASC"
    
      - name: inbacklog-recent
        help: Show recent (default 2 weeks) issues that are not in the sprint (use add2sprint to add them in). --distance can be 1w, 2w, 1d, 2d etc (see man date).
        options:
          - name: distance
            short: d
            default: 2w
        script: |-
          SRCH_DATE=$( date -v-{{options.distance}}  +%Y-%m-%d )
          {{jira}} list --query "project = ${JIRA_PROJECT} AND ( sprint NOT IN openSprints() OR sprint IS EMPTY ) AND created > ${SRCH_DATE} AND resolution IS EMPTY ORDER BY rank ASC"
    
      - name: epics
        help: Show all Epics that are not closed
        script: |-
          {{jira}} list --query "project = ${JIRA_PROJECT} AND issuetype = Epic AND resolution IS empty ORDER BY rank ASC"
    
      #
      # General search commands
      #
    
      - name: search
        help: Search only open issues, in the summary, comments and description for matching text.
        args:
          - name: QUERY
            required: true
        script: |-
          {{jira}} list --query "project = ${JIRA_PROJECT} AND (resolution IS EMPTY) AND (summary ~ \"{{args.QUERY}}\" or comment ~ \"{{
    note the "add2sprint"
    coryb
    @coryb
    yeah, I think we can remove the dep on jq and python
    board_id=$(jira req '/rest/agile/1.0/board?name=NAME' --gjq 'values.#[name=NAME].id')
    Ramon Buckland
    @rbuckland
    cool.
    coryb
    @coryb
    you can just add a NAME argument, perhaps with a default
    or a NAME option
    Ramon Buckland
    @rbuckland
    The version of jira we are running didn't support NAME. That comes in a later jira verison
    ?name= rather.
    coryb
    @coryb
      options: board
      default: MYBOARD
    oh, funny, it worked on ours
    Ramon Buckland
    @rbuckland
    Oh I see.
    coryb
    @coryb
    you get back too much json when you match on name, so I filter via the gjson query
    I think that will remove your dep on jq and python
    Ramon Buckland
    @rbuckland
    you don't need {{ on the NAME ?
    like .. args.NAME ?
    options.NAME rather.
    coryb
    @coryb
    sure, I it was an example
    I would replace the NAME in argument with {{options.NAME}} in both locations
    Ramon Buckland
    @rbuckland
    :-) The problem comes that the board name has spaces, and must be encoded with %20 etc.
    coryb
    @coryb
    and then add the
    options:
      - name: board
        default: MYBOARD
    Ramon Buckland
    @rbuckland
    You can just encode it in the option value .. "My%20Project%20-%20Scrum"
    coryb
    @coryb
    (I had a typo in the first options example above)
    um, I think you can do that with teh template
    Ramon Buckland
    @rbuckland
    go template ..
    coryb
    @coryb
    yeah, {{options.NAME | urlquery }}
    those are the built in ones
    Ramon Buckland
    @rbuckland
    nice.
    coryb
    @coryb
    jira adds a few more
    This is the list of template functions we add to jira on top of the golang ones: https://github.com/Netflix-Skunkworks/go-jira/blob/master/jiracli/templates.go#L65
    most of them are for text formatting for the jira issue output (to help make tables etc)
    Ramon Buckland
    @rbuckland
    ta. I'll do some refinement.
    coryb
    @coryb
    I think you can get the sprint id with:sprint_id=$(jira req "/rest/agile/1.0/board/$board_id/sprint?state=active" --gjq values.0.id)
    Brendan Thompson
    @BrendanThompson
    Just wondering if anyone has thought about counting the current points in the active sprint
    coryb
    @coryb
    @BrendanThompson Not to my knowledge. I have not seen something like that in a github issue/question at least.
    Brendan Thompson
    @BrendanThompson
    @coryb hmm something I’m pretty keen to get working. Couldn’t grok it at all today :(
    coryb
    @coryb
    @BrendanThompson I am not sure where points are stored for the apis. That would be the first step. We dont have a lot of sprint specific apis exposed, and the API documentation for the sprint apis are not great. You can hack around with jira req ... to send arbitrary requests to the jira server using your current authentication, that might be the easiest place to start.
    Rohit Awasthi
    @rawasthi
    @rawasthi
    I am able to successfully configure the JIRA collector for Hygieia. It displays all stories in current sprint. But there are bug fixes, features and tasks that I also want to display along with stories.
    Kindly let me know how to display everything which is on my JIRA board.
    feature.jiraIssueTypeNames=Story, Bug, Improvement, Task, Epic, Feature, Enhancement, Sub-task
    feature.jiraSprintDataFieldName=customfield_1000
    feature.jiraEpicIdFieldName=customfield_1001
    feature.jiraStoryPointsFieldName=customfield_1002

    feature.jiraTeamFieldName=

    Henrik Farre
    @henrik-farre
    Hi, if I do jira create -o priority=Minor then the create template shows the correct value, but how do I echo it from an executable ~/.jira.d/config.yml ?
    Henrik Farre
    @henrik-farre
    Oh, it has to be formatted as a list :)
    case $JIRA_OPERATION in create) echo "issuetype: Task" printf "overrides:\n priority: Minor\n" ;; list) echo "template: table" ;; esac
    Jonatan Brager Sidén
    @bragjo
    Hi guys
    I'm seeking some help regarding webhooks and JQL. I want to trigger a webhook on a custom field if my custom field value changes from NOT empty to EMPTY, does anyone know how to do this?
    I tried with "myCustomfield" changed FROM EMPTY with no success