VSTS-下载触发工件 [英] VSTS - Download triggering artifact
问题描述
我目前已经定义了一个版本,用于将客户端推送到内部nuget服务器.
每个版本的步骤都是相同的,唯一改变的是触发工件.
但是,当我向通用"发行版中添加另一个工件时,使得该发行版上现在有ClientA
和ClientB
工件,触发发行版时将同时下载这两个工件,然后将它们都推送./p>
我想知道的是,是否有可能仅发布版本 下载触发工件.
示例:
在ClientA
和ClientB
上都触发了释放.
ClientB
被释放.构建触发并且仅在部署期间使用ClientB
工件.
我目前不认为这是可能的,但是类似的事情还是有可能的.
根据当前版本定义创建任务组,如下所述: https://docs.microsoft.com/zh-cn/vsts/pipelines/library/task-groups?view=vsts
克隆版本定义,并将工件从ClientA更改为ClientB.
您最终将拥有两个发行版定义,两个版本都共享步骤,但是工件会有所不同.
用于下载构建工件的PowerShell脚本
Eddie建议了一个不错的解决方法.这是您可以手动下拉工件的方法.
-
您需要启用允许脚本访问OAuth令牌
-
在每个阶段添加一个PowerShell任务,并引用 DownloadBuildArtifacts. ps1 脚本
如果发布是由构建工件触发的,则预定义变量"$(RELEASE.TRIGGERINGARTIFACT.ALIAS)"的值将是触发的工件别名.您可以获取此变量的值,以确定哪个工件触发了发布.
I currently have a release defined for pushing clients to an internal nuget server.
Each release is identical in terms of steps, the only thing that changes is the triggering artifact.
However when I add another artifact to a "generic" release, so that there are now ClientA
and ClientB
artifacts on the release, both artifacts are downloaded when the release is triggered and they are both then pushed.
What I would like to know is if it is possible to have the release only download the triggering artifact.
Example:
A release is triggered on both ClientA
and ClientB
.
ClientB
is released. The build triggers and only uses the ClientB
artifact during the deployment.
I don't think this is possible at the moment, but something similar is possible though.
Create a task group from the current release definition as described here: https://docs.microsoft.com/en-us/vsts/pipelines/library/task-groups?view=vsts
There clone the release definition and change the artifact from ClientA to ClientB.
You'll end up having two release definition, both sharing the steps but the artifacts will be different.
EDIT: PowerShell script to download Build artifacts
Eddie suggested a nice workaround. Here's how you can pull down an artifact manually.
You need to enable Allow scripts to access OAuth token
Add a PowerShell task to each phase and reference the DownloadBuildArtifacts.ps1 script
If the release is triggered by build artifacts, the value of the pre-defined variable "$(RELEASE.TRIGGERINGARTIFACT.ALIAS)" will be the triggered artifacts alias. You can get the value of this variable to determine which artifact trigger the release.
这篇关于VSTS-下载触发工件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!