简体   繁体   中英

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. The issue I'm running into is finding a way to exclude the NuGet publish steps for the verification builds in a pull request. 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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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