0

I am aware of the Skipping CI for individual commits in Azure DevOps Pipelines, but I would like to know if it is possible to Skip CI for commits made by a specific Git user?

We have an external system making commits, and we can't simply add the message to the commit message, so it would be useful to just do it based on username.

Josh Wright
  • 422
  • 3
  • 12

2 Answers2

1

There isn't such a feature in Azure DevOps Pipeline. However, as you have mentioned in Skipping CI, if the user is a script creating and pushing commits and you have control over it, you could decide whether to trigger the CI pipeline or not by inserting (or not) [ci skip] or [skip ci] in the commit message.

Otherwise, you have to ask the specific user to push the commits with [ci skip] or [skip ci] in the commit message.

However, the idea sounds good. You could submit a suggestion ticket to suggest the feature on: https://developercommunity.visualstudio.com/report?space=21&entry=suggestion That will allow you to directly interact with the appropriate product group and make it more convenient for the product group to collect and categorize your suggestions.

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • Yes, I understand that this commit message would be the best approach. Thank you for the link to the Developer Community. I have added the feedback [here](https://developercommunity.visualstudio.com/t/Pipeline-Trigger-based-on-Git-Commit-use/10247427). – Josh Wright Jan 07 '23 at 13:53
1

It won't possible to configure this at the trigger level.

A workaround should be to cancel the pipeline based on a custom condition.

The identity of the user can be retrieved using environment variables Build.RequestedFor and Build.RequestedForId

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#how-are-the-identity-variables-set

With this, you can create a custom condition for pipeline execution, based on what is documented here Is it possible to cancel a Azure DevOps pipeline Job programmatically?

It's a workaround, so pipeline will be executed anyway but it will be cancelled and won't execute all stages/jobs/steps.

sylvainmtz
  • 146
  • 3