简体   繁体   English

如何为最佳实践Azure Artifacts CI / CD配置单个管道

[英]How do I configure a single pipeline for a best practice Azure Artifacts CI/CD

I'm trying to get a single pipeline to handle the full CI/CD for internal NuGet Package Projects. 我试图获得一个管道来处理内部NuGet封装项目的完整CI / CD。 The issue I'm running into is finding a way to exclude the NuGet publish steps for the verification builds in a pull request. 我遇到的问题是寻找一种方法来排除在提取请求中进行验证构建的NuGet发布步骤。 Is there a way to identify that the build was triggered as a pull request verification build? 有没有办法确定该构建是作为拉取请求验证构建触发的?

I've gone as far as to set a third branch (master -> release; pre-release -> alpha; develop doesn't publish) but unless I require developers to branch off of develop and do a pull request into it I'm still having the same issue. 我已经尽力设置了第三个分支(主->发布;预发布-> alpha; develop不会发布),但是除非我要求开发人员从development分支并向其中执行拉取请求,否则我会我仍然有同样的问题。 And even then the pull request from develop to pre-release and pre-release to release still have the issue unless I remove the verification build from the pull request. 即使这样,从开发到预发布以及从预发布到发布的请求仍然存在问题,除非我从请求中删除验证版本。 Which I don't want to have to do. 我不想做。

I've used the msdn provided branch conditions, but they don't help on pull request verification builds. 我使用了msdn提供的分支条件,但是它们对拉取请求验证的构建没有帮助。

The verification build ends up publishing the version before the code review, then the subsequent build from the merge fails because the version already exists. 验证版本最终会在代码检查之前发布版本,然后合并后的后续版本将失败,因为该版本已存在。

In the custom condition of the publish task put this: 在发布任务的自定义条件中输入以下内容:

and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))

Now the task not will be executed if the build is a verification build during the PR. 现在,如果构建是PR期间的验证构建,则将不执行任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM