[英]Accessing Published Artifacts from yaml pipeline tasks
I have a PowerShell task that processes published artifacts from another stage.我有一个 PowerShell 任务,它处理从另一个阶段发布的工件。
I have noticed these are put into a folder "s".我注意到这些被放入文件夹“s”中。 Random sampling shows its "s" all the time but I doubt if it will be the case always!
随机抽样一直显示它的“s”,但我怀疑它是否会一直如此!
Wondering what's the best way to refer to these files safely?想知道安全引用这些文件的最佳方法是什么?
Here's my publish artifacts task:这是我的发布工件任务:
Published artifacts:发布的工件:
And the PowerShell task that consumes these artifacts:以及使用这些工件的 PowerShell 任务:
The predefined variable you are looking for is $(System.DefaultWorkingDirectory).您要查找的预定义变量是 $(System.DefaultWorkingDirectory)。 Please refer to the documentation to see this variables definition
请参阅文档以查看此变量定义
The variable that you use does not work with the s
folder.您使用的变量不适用于
s
文件夹。 As described on the documentation Build.ArtifactStagingDirectory
is the local path on the agent where any artifacts are copied to before being pushed to their destination.如文档
Build.ArtifactStagingDirectory
中所述,是代理上的本地路径,任何工件在被推送到目的地之前都会复制到该路径。 For example: c:\agent_work\1\a
.例如:
c:\agent_work\1\a
。 You will find those files under a
folder.您将在文件夹下
a
这些文件。 The folder that is referred with the s
letter is where the sources are downloaded Build.SourcesDirectory
.带有
s
字母的文件夹是下载源代码的地方Build.SourcesDirectory
。
https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
Documentation on Azure devops predfined variables that can be used and where the folders are located. Azure 上的文档开发了可以使用的预定义变量以及文件夹所在的位置。
https://blog.geralexgr.com/devops/how-azure-devops-pipelines-agent-works https://blog.geralexgr.com/devops/how-azure-devops-pipelines-agent-works
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.