How do you publish files back to VSTS Release Management as part of a release?

送分小仙女□ 提交于 2019-12-22 06:29:12

问题


I'm trying to upload log files created by a 3rd party exe during a deployment and including it in the results of my deployment, on a separate tab if possible.

I tried using the publish artifact build tasks but that only works for build not release.

I tried logging tasks but ##vso[build.uploadlog]<local file path> seems to be for builds as well since it complains about finding a container for the build.


回答1:


Release management does not have a container for build artifacts, that's why you see this error message.

You can try with following task:

Write-host "##vso[task.uploadfile]<filename>"

View and download attachments associated with releases

Would you like to upload additional logs or diagnostics or images when running tasks in a release? This feature enables users to upload additional files during deployments. To upload a new file, use the following agent command in your script:

Write-host "##vso[task.uploadfile]"

The file is then available as part of the release logs. When you download all the logs associated with the release, you will be able to retrieve this file as well.

You can also add a powershell script task in your release definition to read the log files and output it to the console. Then you will be see the content of the log files from "Logs" tab powershell script step. And you can also click "Download all logs as zip" to download the logs.




回答2:


I hope to provide more clarity to those looking for an answer. The accepted answer does work.

I had a lot of files (browser screenshots) to add to the release logs. Here's what I did:

If you have lots of files, Archive them into a zip.

Attach the zip to the log files via powershell.

Download the logs

Unzip and enjoy!




回答3:


@DonRolling, thanks for the detailed answer. In my case instead of adding a new task to compress the folder i just included that part in the powershell:

Compress-Archive -Path "$(System.DefaultWorkingDirectory)/TestFolder/ScreenShots" -DestinationPath "$(System.DefaultWorkingDirectory)/TestFolder/ScreenShots" -Force

Write-host "##vso[task.uploadfile]$(System.DefaultWorkingDirectory)/TestFolder/ScreenShots.zip"


来源:https://stackoverflow.com/questions/38456303/how-do-you-publish-files-back-to-vsts-release-management-as-part-of-a-release

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!