Need to create a YAML based azure build pipeline i.e, need to run particular tasks like only build step when it is PR automated and when the same pipeline manually run it should run build task along with archive and publish artifact tasks
Asked
Active
Viewed 94 times
-2
-
1Hello and welcome to StackOverflow. please take a moment and read this article https://stackoverflow.com/help/how-to-ask about how to asking questions also read this article https://stackoverflow.com/help/minimal-reproducible-example about how to ask a good question with minimum requirement. – nima Aug 14 '21 at 18:50
-
please share with us your workout, code snippets, error logs, or any useful information to help answer your question. – nima Aug 14 '21 at 18:50
1 Answers
0
You can distinguish with the Build.Reason https://learn.microsoft.com/en-US/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#build-variables-devops-services in the yaml pipeline why a build was triggered. This you might set as condition in your build stages/jobs/steps.
See the following example from one of our build pipelines:
- task: DotNetCoreCLI@2
displayName: "Publish NuGet"
condition: and(succeeded(), ne(variables['Build.Reason'], 'Schedule'))
inputs:
command: 'push'
searchPatternPush: '$(Build.SourcesDirectory)/source/**/*.nupkg'
nuGetFeedType: 'internal'
feedPublish: 'MyFeed'

milbrandt
- 1,438
- 2
- 15
- 20