【问题标题】:Azure Devops Passing build id as parameter to YAML deployment pipelineAzure Devops 将构建 ID 作为参数传递给 YAML 部署管道
【发布时间】:2021-06-24 23:09:16
【问题描述】:
我想在 YAML 部署管道中创建一个参数,让用户在手动运行时提及他们想要传递以进行部署的构建 ID。
如何在部署管道中使用作为参数传递的特定构建 ID?
部署管道资源定义为:
resources:
pipelines:
- pipeline: build
source: build_pipeline_name
trigger:
branches:
- master
由于对我们在管道中使用的环境的访问限制,无法从资源中选择。
【问题讨论】:
标签:
azure-devops
azure-pipelines
devops
azure-pipelines-yaml
azure-devops-pipelines
【解决方案1】:
如果您只想下载特定的工件,您将无法仅使用资源来执行此操作,因为您无法对资源进行参数化。但是,如果这是您的目标,您可以将此任务参数化:
parameters:
- name: runId
type: number
# Download an artifact named 'WebApp' from a specific build run to 'bin' in $(Build.SourcesDirectory)
steps:
- task: DownloadPipelineArtifact@2
inputs:
source: 'specific'
artifact: 'WebApp'
path: $(Build.SourcesDirectory)/bin
project: 'FabrikamFiber'
pipeline: 12
runVersion: 'specific'
runId: ${{ parameters.runId }}
但是,我不确定我是否理解你。