Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Release Notes (Crossplatform) append feature not working #853

Closed
anil-k-s opened this issue Oct 20, 2020 · 7 comments
Closed

Generate Release Notes (Crossplatform) append feature not working #853

anil-k-s opened this issue Oct 20, 2020 · 7 comments

Comments

@anil-k-s
Copy link

Generate Release Notes (Crossplatform) append feature not working.

Version: 3.23.2.

Below is yml code which I am using in azure pipeline

  • task: XplatGenerateReleaseNotes@3
    inputs:
    outputfile: '$(System.DefaultWorkingDirectory)/releasenotes.md'
    templateLocation: 'InLine'
    inlinetemplate: |
    # Notes for release {{releaseDetails.releaseDefinition.name}}
    **Environment: '$(env-type)'
    Release Number : {{releaseDetails.name}}
    Release completed : {{releaseDetails.modifiedOn}}
    Build Number: {{buildDetails.id}}
    Compared Release Number : {{compareReleaseDetails.name}}
    Build Trigger PR Number: {{lookup buildDetails.triggerInfo 'pr.number'}}

    # release Details Object
    {{{json releaseDetails}}}
    
    # build Details Object
    {{{json buildDetails}}}
    
    # pull request Object
    {{{json pullRequests}}}
    
    # builds Object
    {{{json builds}}}
    
     # commits Object
    {{{json commits}}}
    
     # relatedWorkItems Object
    {{{json relatedWorkItems}}}
    
     # compareReleaseDetails Object
    {{{json compareReleaseDetails}}}
    
     # compareReleaseDetails Object
    {{{json compareBuildDetails}}}
    
    
    # compareReleaseDetails Object
    {{{json currentStage}}}
    
    # Associated Pull Requests ({{pullRequests.length}})
    {{#forEach pullRequests}}
    {{#if isFirst}}### Associated Pull Requests (only shown if  PR) {{/if}}
    *  **PR {{this.id}}**  {{this.title}}
    {{/forEach}}
    
    # Builds with associated WI(workitems)/CS(commits) ({{builds.length}})
    {{#forEach builds}}
    {{#if isFirst}}## Builds {{/if}}
    ##  Build {{this.build.buildNumber}}
    {{#forEach this.commits}}
    {{#if isFirst}}### Commits {{/if}}
    - CS {{this.id}}
    {{/forEach}}
    {{#forEach this.workitems}}
    {{#if isFirst}}### Workitems {{/if}}
    - WI {{this.id}}
    {{/forEach}} 
    {{/forEach}}
    
    # Global list of WI with PRs, parents and children
    {{#forEach this.workItems}}
    {{#if isFirst}}### WorkItems {{/if}}
    *  **{{this.id}}**  {{lookup this.fields 'System.Title'}}
       - **WIT** {{lookup this.fields 'System.WorkItemType'}} 
       - **Tags** {{lookup this.fields 'System.Tags'}}
       - **Assigned** {{#with (lookup this.fields 'System.AssignedTo')}} {{displayName}} {{/with}}
       - **Description** {{{lookup this.fields 'System.Description'}}}
       - **PRs**
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Pull Request')}}
    {{#with (lookup_a_pullrequest ../../pullRequests  this.url)}}
          - {{this.pullRequestId}} - {{this.title}} 
    {{/with}}
    {{/if}}
    {{/forEach}} 
       - **Parents**
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Parent')}}
    {{#with (lookup_a_work_item ../../relatedWorkItems  this.url)}}
          - {{this.id}} - {{lookup this.fields 'System.Title'}} 
          {{#forEach this.relations}}
          {{#if (contains this.attributes.name 'Parent')}}
          {{#with (lookup_a_work_item ../../../../relatedWorkItems  this.url)}}
             - {{this.id}} - {{lookup this.fields 'System.Title'}} 
          {{/with}}
          {{/if}}
          {{/forEach}} 
    {{/with}}
    {{/if}}
    {{/forEach}} 
       - **Children**
    {{#forEach this.relations}}
    {{#if (contains this.attributes.name 'Child')}}
    {{#with (lookup_a_work_item ../../relatedWorkItems  this.url)}}
          - {{this.id}} - {{lookup this.fields 'System.Title'}} 
    {{/with}}
    {{/if}}
    {{/forEach}} 
    {{/forEach}}
    
    # Global list of CS ({{commits.length}})
    {{#forEach commits}}
    {{#if isFirst}}### Associated commits{{/if}}
    * ** ID{{this.id}}** 
       -  **Message:** {{this.message}}
       -  **Commited by:** {{this.author.displayName}} 
       -  **FileCount:** {{this.changes.length}} 
    {{#forEach this.changes}}
          -  **File path:** {{this.item.path}}   
    {{/forEach}}
    {{/forEach}}
    

    dumpPayloadToConsole: false
    dumpPayloadToFile: false
    replaceFile: false
    appendToFile: true
    getParentsAndChildren: false
    getAllParents: false

@rfennell
Copy link
Owner

I cannot repo your problem, I have re-tested the append function and it is working for me. If you do a run with diagnostics on (for a variable system.debug=true) my log shows

Completed processing template
Appending output to file output.md
Finished writing output file output.md

What does yours show?

@anil-k-s
Copy link
Author

Hi ,

I am getting below logs:-

2020-10-20T13:02:13.5213260Z ##[section]Starting: XplatGenerateReleaseNotes 2020-10-20T13:02:13.5224280Z ============================================================================== 2020-10-20T13:02:13.5224680Z Task : Generate Release Notes (Crossplatform) 2020-10-20T13:02:13.5225130Z Description : Generates a release notes file in a format of your choice from the build or release history 2020-10-20T13:02:13.5225490Z Version : 3.23.2 2020-10-20T13:02:13.5225720Z Author : Black Marble 2020-10-20T13:02:13.5226230Z Help : Version: 3.23.2. [More Information](https://github.com/rfennell/AzurePipelines/wiki/GenerateReleaseNotes---Node-based-Cross-Platform-Task/) 2020-10-20T13:02:13.5226780Z ============================================================================== 2020-10-20T13:02:14.6954430Z Creating the credential handler from the OAUTH token 2020-10-20T13:02:15.0354820Z Getting the current build details 2020-10-20T13:02:15.8541170Z Getting items associated the builds since the last successful build to the stage '__default' 2020-10-20T13:02:16.4174560Z Found '33' matching builds to consider 2020-10-20T13:02:16.4175430Z Comparing 193 against 193 2020-10-20T13:02:16.4176120Z Ignore compare against self 2020-10-20T13:02:16.4176590Z Comparing 192 against 193 2020-10-20T13:02:16.4177020Z Considering build 2020-10-20T13:02:16.6641000Z Found required stage __default in the completed and successful state in build 192 2020-10-20T13:02:16.6641730Z Getting the details between 192 and 193 2020-10-20T13:02:17.0584600Z Using workaround for build API limitation (see issue #349) 2020-10-20T13:02:17.7719230Z Processing commits found 2020-10-20T13:02:18.3117670Z Get the file details associated with the commits 2020-10-20T13:02:18.3118630Z Enriched change b4acec60fd6534b55127afa64574a06ee38dae38 of type TfsGit 2020-10-20T13:02:18.6417360Z Enriched with details of 1 files 2020-10-20T13:02:18.6418150Z Enriched change 4270b898ead721256269153ae83beed8fb2e2bbb of type TfsGit 2020-10-20T13:02:18.7122710Z Enriched with details of 1 files 2020-10-20T13:02:18.7123730Z Get any test details associated with the build 2020-10-20T13:02:18.8573470Z Removing duplicate Commits from master list 2020-10-20T13:02:18.8575990Z Removing duplicate WorkItems from master list 2020-10-20T13:02:18.8581750Z Expanding the truncated commit messages... 2020-10-20T13:02:18.8582930Z Expanded truncated commit messages 0 2020-10-20T13:02:18.8587680Z Get details of [0] WIs 2020-10-20T13:02:18.8588920Z Total build artifacts: [0] 2020-10-20T13:02:18.8589410Z Total commits: [2] 2020-10-20T13:02:18.8589850Z Total workitems: [0] 2020-10-20T13:02:18.8590310Z Total related workitems: [0] 2020-10-20T13:02:18.8590820Z Total release tests: [0] 2020-10-20T13:02:18.8591270Z Total tests: [0] 2020-10-20T13:02:18.8591740Z Leaving WI in default order as returned by API 2020-10-20T13:02:19.1873080Z The default artifact for the release was not linked to an Azure DevOps Git Repo Pull Request 2020-10-20T13:02:19.1877550Z Getting all completed Azure DevOps Git Repo PRs in the Team Project MyRush Mobile Android 2020-10-20T13:02:19.3478600Z Found 14 Azure DevOps PRs in the repo 2020-10-20T13:02:19.3479560Z Checking for PRs associated with the commit b4acec60fd6534b55127afa64574a06ee38dae38 2020-10-20T13:02:19.3480420Z Checking for PRs associated with the commit 4270b898ead721256269153ae83beed8fb2e2bbb 2020-10-20T13:02:19.3481130Z Total Pull Requests: [0] 2020-10-20T13:02:19.3488660Z Using in-line template 2020-10-20T13:02:19.3950110Z Loading handlebars-helpers extension 2020-10-20T13:02:19.8005140Z Completed processing template 2020-10-20T13:02:19.8006270Z Appending output to file /Users/runner/work/1/s/releasenotes.md 2020-10-20T13:02:19.8051230Z Finished writing output file /Users/runner/work/1/s/releasenotes.md 2020-10-20T13:02:19.8214970Z ##[section]Finishing: XplatGenerateReleaseNotes

As you said I am getting
2020-10-20T13:02:19.8006270Z Appending output to file /Users/runner/work/1/s/releasenotes.md
2020-10-20T13:02:19.8051230Z Finished writing output file /Users/runner/work/1/s/releasenotes.md
but I am not getting last build release notes in current releasenotes.md file.

@rfennell
Copy link
Owner

That is strange, I will re-run my tests with a build as opposed to my test harness, but it looks like it should be working. The logic is not complex and logs show it is taking the route I expect.

An alternative is to not use the append, just generate the file and do the merge with my WIKIUpdater Extension though is only of use if your target is a WIKI

@rfennell
Copy link
Owner

I have had a look at the code again, and is it possible that it is adding the appended content, but if stripping off the fit character so that heading just become standard text, thus looking as if it all merged together e.g.

Header

text
Appended header
text

as opposed to

Header

text

Appended header

text

The reason I ask is this was a recently fixed issue with prepend/append functionality for the WIKIUpdater #826 .

If this is the case I can made the same change to this task to handle unexpected leading special characters

@anil-k-s
Copy link
Author

anil-k-s commented Oct 22, 2020

No this is not the case , I am not even getting single line of older release notes. I also have one question does release notes output file generated by this task every time. if yes, how you are keeping track of old release notes and appending it in newly generated release notes file.

@rfennell
Copy link
Owner

Stranger and stranger....

As I cannot get a repo of this problem, and I have tried in both my release pipelines, my test harnesses and debugging in VSCode, all I can think to do to debug it further is for you to either

  • Run the build on a private build agent and inspect the _work folder to look at the files present
  • Or better still, run using my console tester process against your instance and build to investigate what is going on. You can added lines to debu as you need

In answer to your second question, the most common usage of the task, from the feedback I have had from users, is that they generate the release notes for the build/release as a new file. This details just the changes since the last successful release. This file is then

  • Associated as pipeline artifact - useful for builds
  • Sent as a email or similar to interested parties, using some other Azure DevOps task
  • Or most commonly uploaded to a WIKI as a new page, so each page is a set of release notes. This is done using my WIKIUpdater task

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants