How to publish list of issues fixed in build to artifacts (OD-2181)
Brent Hitzeroth opened 1 year ago

How can I publish a list of issues fixed in a build to the build artifacts folder?

  • Robin Shen commented 1 year ago

    This can not be published to artifacts folder as a file, unless to write some code to get list of fixed issues via restful api. Curious why need to publish this to artifacts folder?

  • Brent Hitzeroth commented 1 year ago

    I am attempting to automate the build revision history file so that I can package a txt file with the bug fixes and changes in it. This can then be bundled with the artifacts and published together. often in our business the installers are waiting for a specific bug fix or added feature and this would allow then just to read the build-history.txt file.

  • Robin Shen commented 1 year ago

    Below build spec can be used to publish fixed issues as file. You may use your own docker image instead of 1dev/build-environment as long as your docker image has curl and jq installed. Also make sure to add a job secret access token with value set to an access token allowed to access these restful apis.

    version: 37
    jobs:
    - name: ci
      steps:
      - !CommandStep
        name: build
        runInContainer: true
        image: 1dev/build-environment:1.6
        interpreter: !DefaultInterpreter
          commands: |
            build_id=$(curl -H "Authorization: Bearer @secret:access token@" -G @server_url@/~api/builds --data-urlencode 'query="Number" is "@project_path@#@build_number@"' --data-urlencode offset=0 --data-urlencode count=1 | jq '.[0].id')
    
            fixed_issue_ids=$(curl -H "Authorization: Bearer @secret:access token@" -G @server_url@/~api/builds/${build_id}/fixed-issue-ids | jq '.[]')
    
            for issue_id in $fixed_issue_ids; do
            issue_title=$(curl -H "Authorization: Bearer @secret:access token@" -G @server_url@/~api/issues/${issue_id} | jq -r '.title')
            issue_type=$(curl -H "Authorization: Bearer @secret:access token@" -G @server_url@/~api/issues/${issue_id}/fields | jq -r '.Type')
            echo $issue_type - $issue_title >> fixed_issues.txt
            done
        useTTY: true
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !PublishArtifactStep
        name: publish fixed issues
        artifacts: fixed_issues.txt
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      retryCondition: never
      maxRetries: 3
      retryDelay: 30
      timeout: 14400
    
  • Brent Hitzeroth commented 1 year ago

    Thank you Robin, great work.

  • Robin Shen changed state to 'Closed' 1 year ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2181
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover