有没有办法从构建我的工件的源文件或文件夹名称中抓取变量信息?

Is there a way to scrape variable information from the source files or folder names that my artifact is built from?

我已经在 Azure Devops / TFS 中自动化了一个 build/deploy 过程,并且想从用于我的构建工件的源文件路径中抓取一个文件或文件夹名称作为变量。

例如,我可能想在构建源路径中抓取文件夹的文件夹名称并将其存储以供构建#、发布#等使用

我已经阅读了 Microsoft 的文档,我相信我正在寻找的信息可能与以下内容相关...但我似乎找不到正确的位置。

Release.Artifacts.{alias}.BuildURI  #The URL for the build.

Azure pipelines example: vstfs://build-release/Build/130
GitHub example: https://github.com/fabrikam/asp

当我试图从源代码中找到文件夹名称时,到目前为止我一直无法在代码中找到它。

抱歉,无法从环境变量中获取源文件和文件夹 name/Artifact 名称。

截至目前,您需要指定 Artifact alias name 才能访问神器相关信息。

例如,Release.Artifacts.{alias}.DefinitionName

General Artifact variables

Primary Artifact Variables

使用默认变量,您可以通过两种方式使用默认变量 - 作为发布管道或脚本中任务的参数。 here