我有一个步骤定义模板,我打算在构建管道中使用它。步骤定义的位置与构建管道本身不在同一文件夹下。
在管道验证期间,AzureDevops 将构建管道的位置视为根位置。这被附加到引用的路径
考虑以下代码层次结构示例
azure
|----products
|----resource-type1
|----step-def.yaml
|----resource-type2
|----step-def.yaml
|----solutions
|----solution1
|----local-step-def.yaml
|----build.yaml
|----solution2
|----build.yaml
Run Code Online (Sandbox Code Playgroud)
当 build.yaml 如下所示时,以下工作
jobs:
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
steps:
- template: solution1/local-step-def.yml
Run Code Online (Sandbox Code Playgroud)
如果您更改模板参考如下,则不起作用
- template: ../products/resource-type1/step-def.yml
Run Code Online (Sandbox Code Playgroud)
在管道上完成验证后,azure-devops 映射到
# <path-of-the-build-pipeline>/<template-ref>
azure/solutions/solution1/<template-reference>
Run Code Online (Sandbox Code Playgroud)
那么如何映射到位于 products 文件夹层次结构中的 step-def.yaml 文件?
我有一个 yaml 管道,使用任务 Azure Powershell 任务 https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-powershell?view=azure-devops
该脚本已经具有如下任务输出:
$output = ConvertTo-Json -InputObject @{
resourceName = "aseName"
resourceGroupName = "ResourceGroupName"
} -Compress
Write-Output "##vso[task.setvariable variable=output;]$output"
Run Code Online (Sandbox Code Playgroud)
在后续任务中,在同一作业内。我需要将其用作 {output.resourceName}。通常,设计师可以按照我想要的方式将其设计出来。但对于 YAML 我无法弄清楚。
有什么指点吗?