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

PDFExport #978

Closed
peterz84 opened this issue Mar 17, 2021 · 4 comments · Fixed by #979
Closed

PDFExport #978

peterz84 opened this issue Mar 17, 2021 · 4 comments · Fixed by #979
Assignees

Comments

@peterz84
Copy link

Just getting started with the WikiPdfExportTask. Im trying to Generate Release Notes and then export it to a PDF and then publish it as an artifact.

My generate release notes task (I removed some inlinetemplate lines):

task: XplatGenerateReleaseNotes@3
  inputs:
    outputfile: '$(System.DefaultWorkingDirectory)\Release Notes.md'
    templateLocation: 'InLine'
    inlinetemplate: |
      ## Build {{buildDetails.buildNumber}}
      * **Branch**: {{buildDetails.sourceBranch}}
      * **Tags**: {{buildDetails.tags}}
      * **Completed**: {{buildDetails.finishTime}}
      * **Previous Build**: {{compareBuildDetails.buildNumber}}
    dumpPayloadToConsole: false
    dumpPayloadToFile: false
    replaceFile: True
    getParentsAndChildren: False
    getAllParents: False
    getIndirectPullRequests: False

My WikiPdfExportTask

- task: WikiPdfExportTask@1 
  displayName: 'Export File generated by the release notes task to PDF'
  inputs:
    cloneRepo: false
    localpath: '$(System.DefaultWorkingDirectory)'
    singleFile: 'Release Notes.md'
    outputFile: '$(Build.ArtifactStagingDirectory)\PDF\Release Notes.pdf'

I supposed the directory of the outputfile from the first task should be the same as the localpath of the second task, right?

The error I'm getting:

Using the EXE path of C:\Program Files\DevOpsAgent\_work\_temp\azuredevops-export-wiki.exe for AzureDevOps.WikiPDFExport
A filename Release Notes.md in the folder C:\Program Files\DevOpsAgent\_work\5\s has been requested so only processing that file 
Adding the verbose flag to increase logging
Creating folder C:\Program Files\DevOpsAgent\_work\5\a\PDF
Changing folder to C:\Program Files\DevOpsAgent\_work\5\s
Using command 'C:\Program Files\DevOpsAgent\_work\_temp\azuredevops-export-wiki.exe  -p C:\Program Files\DevOpsAgent\_work\5\s -s Release Notes.md -o C:\Program Files\DevOpsAgent\_work\5\a\PDF\Release Notes.pdf -v'

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

##[error]Error: Command failed: C:\Program Files\DevOpsAgent\_work\_temp\azuredevops-export-wiki.exe  -p C:\Program Files\DevOpsAgent\_work\5\s -s Release Notes.md -o C:\Program Files\DevOpsAgent\_work\5\a\PDF\Release Notes.pdf -v
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

##[error]Error: Command failed: C:\Program Files\DevOpsAgent\_work\_temp\azuredevops-export-wiki.exe  -p C:\Program Files\DevOpsAgent\_work\5\s -s Release Notes.md -o C:\Program Files\DevOpsAgent\_work\5\a\PDF\Release Notes.pdf -v
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

When I use outputfile: '$(Build.ArtifactStagingDirectory)\Release Notes.md' and localpath: '$(Build.ArtifactStagingDirectory)' the error is the following:

Using the EXE path of C:\Program Files\DevOpsAgent\_work\_temp\azuredevops-export-wiki.exe for AzureDevOps.WikiPDFExport
A filename Release Notes.md in the folder C:\Program Files\DevOpsAgent\_work\5\a has been requested so only processing that file 
##[error]Cannot find the requested file Release Notes.md to export
##[error]Cannot find the requested file Release Notes.md to export
Finishing: Export File generated by the release notes task to PDF

What am I doing wrong?

@rfennell
Copy link
Owner

I think the issue is that your agent folder under a path with a space in it

Using command 'C:\Program Files\DevOpsAgent_work_temp\azuredevops-export-wiki.exe -p C:\Program Files\DevOpsAgent_work\5\s -s Release Notes.md -o C:\Program Files\DevOpsAgent_work\5\a\PDF\Release Notes.pdf -v'
'C:\Program' is not recognized as an internal or external command, operable program or batch file.

This is a bug, I need to write a fix for that to add some quotes around the EXE file path

The alternative is to download the azuredevops-export-wiki.exe to a known location on the build agent and pass this path in using the 'overrideExePath' parameter.

I will get onto the bug ASAP, should be out in the next 24 hrs.

Thanks for reporting it

@rfennell
Copy link
Owner

Oh, the other option is to install your agent on a path without a space in the path e.g the default c:\agent. Having the agent in a folder with a short path can also help if your project has long paths as some tools still suffer from the 256 char limit

@peterz84
Copy link
Author

I added an agent in C:\Agent. The first error is gone indeed, but still the error:

Using the EXE path of C:\agent\_work\_temp\azuredevops-export-wiki.exe for AzureDevOps.WikiPDFExport
A filename Release Notes.md in the folder C:\agent\_work\1\a has been requested so only processing that file 
##[error]Cannot find the requested file Release Notes.md to export
##[error]Cannot find the requested file Release Notes.md to export

Script:

- task: XplatGenerateReleaseNotes@3
  inputs:
    outputfile: '$(Build.ArtifactStagingDirectory)\Release Notes.md'
    templateLocation: 'InLine'
    inlinetemplate: |
      ## Build {{buildDetails.buildNumber}}
      * **Branch**: {{buildDetails.sourceBranch}}
      * **Tags**: {{buildDetails.tags}}
      * **Completed**: {{buildDetails.finishTime}}
      * **Previous Build**: {{compareBuildDetails.buildNumber}}
      
      ## Associated Pull Requests ({{pullRequests.length}})
      {{#forEach pullRequests}}
      * **[{{this.pullRequestId}}]({{replace (replace this.url "_apis/git/repositories" "_git") "pullRequests" "pullRequest"}})** {{this.title}}
      * Associated Work Items
      {{#forEach this.associatedWorkitems}}
         {{#with (lookup_a_work_item ../../relatedWorkItems this.url)}}
          - [{{this.id}}]({{replace this.url "_apis/wit/workItems" "_workitems/edit"}}) - {{lookup this.fields 'System.Title'}} 
         {{/with}}
      {{/forEach}}
      * Associated Commits (this includes commits on the PR source branch not associated directly with the build)
      {{#forEach this.associatedCommits}}
          - [{{this.commitId}}]({{this.remoteUrl}}) -  {{this.comment}}
      {{/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 (TFVC or TfsGit):** {{this.item.path}}  
            -  **File filename (GitHub):** {{this.filename}}  
      {{/forEach}}
      {{/forEach}}
      
      ## Manual Test Plans
      | Run ID | Name | State | Total Tests | Passed Tests |
      | --- | --- | --- | --- | --- |
      {{#forEach manualTests}}
      | [{{this.id}}]({{this.webAccessUrl}}) | {{this.name}} | {{this.state}} | {{this.totalTests}} | {{this.passedTests}} |
      {{/forEach}}
    dumpPayloadToConsole: false
    dumpPayloadToFile: false
    replaceFile: True
    getParentsAndChildren: False
    getAllParents: False
    getIndirectPullRequests: False
- task: WikiPdfExportTask@1 
  displayName: 'Export File generated by the release notes task to PDF'
  inputs:
    cloneRepo: false
    localpath: '$(Build.ArtifactStagingDirectory)'
    singleFile: 'Release Notes.md'
    outputFile: '$(Build.ArtifactStagingDirectory)\PDF\Release Notes.pdf'

@rfennell
Copy link
Owner

This is fixed in 1.6.11

This was referenced Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants