我正尝试将文件( Helloworld.txt )发布到我的 Universal Packages 目录中,以传递到我的Release Piepline中的另一个阶段(使用{{ 1}})。
我一生都无法弄清楚如何使其发挥作用。
我正在尝试遵循此知识库,但这使我感到困惑:
例如,我无法确定 vstsFeedPublish 是什么,也不知道 vstsFeedPackagePublish 可以是我当场写的新名称,还是实际上是现有文件/文件夹的名称。
我输入错误的“路径”会导致失败?
阶段部署步骤:
Helloworld输出到TXT:
UniversalPackages@0
我首先cd $(Build.ArtifactStagingDirectory)
"$(System.DefaultWorkingDirectory)/Helloworld Build/Helloworld EXE Folder/Helloworld.exe" >> WriteLineOutput.txt
进入cd
,因为这是默认文件夹$(Build.ArtifactStagingDirectory)
看起来要发布文件,所以我希望在那里生成UniversalPackages@0
。
将输出TXT发布到通用Dir(YAML):
WriteLineOutput.txt
工作目录结构:
“将输出TXT发布到Universal Dir”任务输出:
steps:
- task: UniversalPackages@0
displayName: 'Publish Output TXT to Universal Dir'
inputs:
command: publish
vstsFeed: '0a3a9abd-83fd-495f-967b-e986c523f2d2'
vstsPackageVersion: 1
vstsFeedPublish: '0a3a9abd-83fd-495f-967b-e986c523f2d2'
vstsFeedPackagePublish: 'writelineoutput-txt'
versionOption: minor
packagePublishDescription: 'TXT output from Helloworld.exe'
关键行:
2019-12-02T03:35:35.2264352Z ##[section]Starting: Publish Output TXT to Universal Dir
2019-12-02T03:35:35.2381247Z ==============================================================================
2019-12-02T03:35:35.2381328Z Task : Universal packages
2019-12-02T03:35:35.2381359Z Description : Download or publish Universal Packages
2019-12-02T03:35:35.2381412Z Version : 0.160.1
2019-12-02T03:35:35.2381461Z Author : Microsoft Corporation
2019-12-02T03:35:35.2381490Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks
2019-12-02T03:35:35.2381520Z ==============================================================================
2019-12-02T03:35:36.0651445Z SYSTEMVSSCONNECTION exists true
2019-12-02T03:35:36.6058302Z Downloading: https://0t3vsblobprodcus362.vsblob.vsassets.io/artifacttool/artifacttool-win10-x64-Release_0.2.128.zip?sv=2017-04-17&sr=b&sig=tHZQU3V2DuXcC0Y1xnmzB7Zw7kMdjJSijWVDiztc9UE%3D&spr=https&se=2019-12-02T04%3A35%3A37Z&sp=r&P1=1575261037&P2=11&P3=2&P4=LS6Ffab5P%2bb8Q9r3aGsGLlK9ELRD6bRxxlTkDc5aEc8%3d
2019-12-02T03:35:39.3862184Z Caching tool: ArtifactTool 0.2.128 x64
2019-12-02T03:35:40.4414172Z SYSTEMVSSCONNECTION exists true
2019-12-02T03:35:41.4415128Z Publishing package: writelineoutput-txt, version: 0.1.0 using feed id: 65dc653c-5c3b-771c-b308-34b199d8fcee, project: null
2019-12-02T03:35:41.4469092Z [command]C:\hostedtoolcache\windows\ArtifactTool\0.2.128\x64\ArtifactTool.exe universal publish --feed 65dc653c-5c3b-771c-b308-34b199d8fcee --service https://vsrm.dev.azure.com/sawtooth-capstone/ --package-name writelineoutput-txt --package-version 0.1.0 --path D:\a\r1\a\$(Build.ArtifactStagingDirectory) --patvar UNIVERSAL_PUBLISH_PAT --verbosity None --description "TXT output from Helloworld.exe"
2019-12-02T03:35:44.0492154Z {"@t":"2019-12-02T03:35:43.3152933Z","@m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","@i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
2019-12-02T03:35:44.0493421Z {"@t":"2019-12-02T03:35:43.7170274Z","@m":"Ensuring that the package does not yet exist...","@i":"40e01e14","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.717Z"}
2019-12-02T03:35:44.0494251Z {"@t":"2019-12-02T03:35:43.8900269Z","@m":"Package does not yet exist","@i":"c781eca5","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.890Z"}
2019-12-02T03:35:44.0494769Z {"@t":"2019-12-02T03:35:43.8913512Z","@m":"Pushing content...","@i":"3aa40378","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.891Z"}
2019-12-02T03:35:44.0495859Z {"@t":"2019-12-02T03:35:43.9060246Z","@m":"DedupManifestArtifactClient will correlate http requests with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","@i":"09a6f3ce","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.906Z"}
2019-12-02T03:35:44.0496478Z {"@t":"2019-12-02T03:35:44.0301714Z","@m":"The path provided is invalid.","@i":"05178f7d","@l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"}
2019-12-02T03:35:44.0776082Z ##[error]Error: An unexpected error occurred while trying to push the package. Exit code(16) and error({"@t":"2019-12-02T03:35:43.3152933Z","@m":"ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","@i":"8778ba0f","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.315Z"}
{"@t":"2019-12-02T03:35:43.7170274Z","@m":"Ensuring that the package does not yet exist...","@i":"40e01e14","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.717Z"}
{"@t":"2019-12-02T03:35:43.8900269Z","@m":"Package does not yet exist","@i":"c781eca5","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.890Z"}
{"@t":"2019-12-02T03:35:43.8913512Z","@m":"Pushing content...","@i":"3aa40378","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.891Z"}
{"@t":"2019-12-02T03:35:43.9060246Z","@m":"DedupManifestArtifactClient will correlate http requests with X-TFS-Session 23e076ea-5122-4c06-b92a-2aef5974defd","@i":"09a6f3ce","SourceContext":"ArtifactTool.Commands.UPackPublishCommand","UtcTimestamp":"2019-12-02 03:35:43.906Z"}
{"@t":"2019-12-02T03:35:44.0301714Z","@m":"The path provided is invalid.","@i":"05178f7d","@l":"Error","SourceContext":"ArtifactTool.Program","UtcTimestamp":"2019-12-02 03:35:44.030Z"})
2019-12-02T03:35:44.0789627Z ##[error]Packages failed to publish
2019-12-02T03:35:44.0898947Z ##[section]Finishing: Publish Output TXT to Universal Dir
编辑:
好吧,我阅读了最佳实践,即使用 Build 管道发布工件,并使用 Release 管道运行/测试工件,所以我决定只发布工件从 Build 管道中删除,而不是尝试在Release管道中再次创建相同的 Helloworld.txt 。但是,如果有人可以帮助我弄清楚如何将在发布管道中创建的新文件发布到 Universal packages 目录中,我愿意接受不可避免的投票。
答案 0 :(得分:0)
我最好建议您调用exe
在 Build 中生成txt
文件。然后将它们作为工件发布以发布管道。然后,您可以轻松地在发布管道中选择HelloWord.txt
文件。
此任务可以在Build和Release管道中使用。在构建和发行版中应用此任务之间的区别只是您非常困惑的Path to file(s) to publish
值。
对于发布管道:
如果要将HelloWord.txt
发布到软件包中,只需单击,然后从中选择相应的文件HelloWord.txt
。
因此,其值应为$(System.DefaultWorkingDirectory)/{Source alias}/{artifact name}/s/HelloWorld.txt
。
注意:当您将在构建管道中生成的txt
放入然后将其发布为artifact
并在发布管道中使用时,将应用此方法。
类似于构建管道,您还可以从该按钮中选择文件。对于其YAML格式,只需输入文件名,如:
inputs:
command: publish
publishDirectory: 'azure-pipelines.txt'
vstsFeedPublish: '*****'
vstsFeedPackagePublish: merlin
versionOption: custom
versionPublish: 0.0.1
packagePublishDescription: published in 2019/12/2
如果azure-pipelines.txt文件位于文件夹下,只需将其输入为{folder name}/azure-pipelines.txt
。
在您的问题中,如果要将文件生成和包发布都放在Build管道中。由于我不太清楚,所以您的HellowWorld.exe
脚本怎么样。 HelloWorld.txt
的位置由您的脚本决定。如果未在脚本中定义生成的文件位置,则默认情况下,此txt
文件路径应与exe
相同。根据您共享的图片,似乎其路径为HelloWorld EXE Folder/HelloWorld.txt
。我建议您首先可以使用私有代理运行此内部版本以确认其(.txt
)路径。
vstsFeedPublish 应该是您在项目中创建的现有Feed。在此,不能是新名称,即在执行管道之前不存在该名称。
vstsFeedPackagePublish 是您要存储在Feed中的软件包名称。对于我来说,在这里我将其命名为merlin
。发布完成后:
您可以指定一个新名称或使用现有名称。使用新名称意味着在Feed中创建一个新程序包,而使用现有名称仅意味着该版本是增量版本。