Azure 管道。从资源库运行脚本

时间:2021-06-02 08:56:51

标签: azure azure-devops devops

我在一个 repo 中有一个 azure pipline 的 yaml 文件。我需要从不同的存储库运行 powershell 脚本。

据我所知,我可以将 side repo 添加到 yaml 中的 resources 部分,然后使用 task:ShellScript@2scriptPath 参数。但据我所知,它对于放置 yaml 的 repo 相对有效。而且我不确定如何从不同的存储库访问文件。

1 个答案:

答案 0 :(得分:1)

是的,您必须使用存储库资源并按如下方式检出该存储库:

resources:
  repositories:
    - repository: devops
      type: github
      name: kmadof/devops-templates
      endpoint: kmadof


steps:
- checkout: self
- checkout: devops
- task: ShellScript@2
  inputs:
    scriptPath: $(Agent.BuildDirectory)/devops/scripts/some-script.sh