繁体   English   中英

使用管道编辑 DevOps 存储库中的文件(版本控制 D365 F&O)

[英]Editing files in the DevOps repository using the pipeline (Versioning D365 F&O)

我使用 Microsoft 托管代理在 Azure DevOps 中创建了一个构建管道。 我希望为每个构建编辑 DevOps 存储库中的 *.xml 文件。 这些是带有版本号的描述符文件。 我写了一个 PowerShell 脚本,但我不知道要指示什么文件位置。

根据您的描述,如果您只有一个checkout步骤,则可以使用预定义变量$(Build.SourcesDirectory) ,这是下载源代码文件的代理上的本地路径。 例如: c:\agent_work\1\s

pool:
  vmImage: windows-latest
steps:
- checkout: self
- script: |
    cd $(Build.SourcesDirectory)
    ls

另请注意,如果您只签出一个 Git 存储库,则此路径将是代码的确切路径。 如果您签出多个存储库,它将恢复为其默认值$(Pipeline.Workspace)/s ,即使将self (主)存储库签出到与其多签出默认路径不同的自定义路径$(Pipeline.Workspace)/s/<RepoName> (在这方面,该变量与Build.Repository.LocalPath变量的行为不同)。

pool:
  vmImage: windows-latest
resources:
 repositories:
  - repository: Test_Repo
    type: git
    name: TheProjectName/Test Repo
    trigger:
      branches:
        include:
        - main
steps:
- checkout: self
- checkout: Test_Repo
- script: |
    cd $(Build.SourcesDirectory)
    ls
- script: |
    cd $(Pipeline.Workspace)/s
    ls

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM