【发布时间】:2021-05-15 11:23:06
【问题描述】:
我们在 YAML 构建中广泛使用共享 YAML 模板。像这样的:
trigger: none
resources:
repositories:
- repository: templates
type: git
name: DFDevOps\cicd-templates
ref: refs/tags/stable-1
# http://tdc1tfsapp01:8080/tfs/DefaultCollection/DFDevOps/_git/cicd-templates
name: $(BuildVersionPrefix).$(DayOfYear)$(Date:HH)
jobs:
- job: Build
pool:
demands: DotNetFramework
workspace:
clean: outputs
timeoutInMinutes: 180
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
clean: true
lfs: true
- template: ci/ci-build.yml@templates
parameters:
releaseBranch: $(ReleaseBranch)
但是,共享 YAML 模板通常需要执行 Powershell 代码。到目前为止,我们要么将其嵌入,要么将其放入模板加载的 PS 模块中。
我讨厌这两种方法。我讨厌嵌入,因为:
- 没有智能感知
- 没有单元测试
- 没有正确报告管道故障的错误
我讨厌放入一个模块,因为它与原点分离并且需要大量开销。
我的问题 - 是否可以将 PS 代码放在与 YAML 模板相同的存储库中的专用 ps1 文件中,并在运行时提供它们?
【问题讨论】:
-
这个问题怎么样?下面的答案是否解决了您的问题,如果没有,请告诉我有关此问题的最新信息吗?
-
我还没查。但我会回来的。
标签: azure-devops yaml azure-devops-server azure-devops-server-2020