2

Context

Our pipeline triggers:

trigger:
  branches:
    include:
      - develop
      - master

pr:
  - master

Our pipeline acts based on some conditions which check which branch it's on, or what triggered the pipeline.

  • Commit to develop triggers bumps the version, commits back to develop, builds and artifacts
  • PR triggers a deployment to acceptance
  • Commit to master triggers a deployment to production

To not have the develop branch trigger itself it commits with [skip ci] in the commit message.

I have verified that it works when I merge a PR that does not contain any [skip ci] commits. So the trigger itself is functional.


Problem

When we merge the PR to master it does NOT trigger the CI trigger at all. In the azure devops panel it never shows up, indicating that it is ignored.

Removing the [skip ci] commit makes this problem go away, but introduces the problem of the pipeline triggering itself constantly.

Our repository is in GitHub, preventing me from manually filtering out based on commit author or something.

I'm somewhat perplexed that a merge commit, containing an older commit with [skip ci] in it, is preventing the trigger from firing.

Am I misunderstanding expected behavior here?

I'm open to workarounds as well.

Apologies if this is answered somewhere already, but I could not find anyone with this exact issue.


Commit log

In red: a merged PR without a [skip ci] commit -- this correctly triggers CI master branch (see underlined commit with checkmark)

In yellow: a merged with a [skip ci] commit -- this does not trigger CI master branch (see underlined commit without checkmark)

Neither merge commits contain more then the title in the commit message.

GitHub Commit Log


Azure DevOps Pipeline log

I've marked the same sections as in the github screenshot for clarity. As you can see an Individual CI for master is missing in the yellow section.

Azure DevOps Pipeline Log

ivoh
  • 21
  • 4

3 Answers3

1

My guess is that the merge commit generates a comment listing all the commit messages for all the included commits. Hence, the commit message of your merge then contains a [skip-ci].

I'm guessing the ideal way to handle this is to either edit the commit message prior to merge or to make sure your skip-ci marker is in the description part of the original commit messages.

This is the first.line of the commit
[skip-ci] < on the second line

That way it gets omitted in the merge commit message.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • Thanks for the suggestion. I considered this, but the merge-commit doesn't contain a list of commits in it's body or anything. Either way I tried this, and it doesn't solve the problem unfortunately. – ivoh Apr 13 '21 at 14:23
1

When we merge the PR to master it does NOT trigger the CI trigger at all. In the azure devops panel it never shows up, indicating that it is ignored.

I could almost reproduce this issue on my side with Github repo.

If we set the trigger for the main pipeline like:

trigger:
  branches:
    include:
      - develop
      - main

pr:
  - main

In order to avoid CI trigger from develop branch, we add [skip ci] in the commit message when commit for develop:

enter image description here

Obviously, our pipeline will not be triggered. It also works fine.

But, if we create a PR to the main branch without the [skip ci] in the context when create the PR:

enter image description here

The result is only have the PR trigger for the main branch.

The CI for main branch after PR complete are not triggered:

enter image description here

If we do not add the [skip ci] when we submit from develop branch, the CI for main branch will be triggered after PR completed.

Then I create a similar sample with Azure devops Git repo. I got the different result.

Regardless of whether we include [skip ci] in the PR context, the CI build of the Main branch will be triggered after the PR is completed. This is the expected result, which is obviously different from the result of the github repo

enter image description here

enter image description here

So, we are not sure if this is an issue or default behaver. I have submit a new ticket about it:

https://developercommunity.visualstudio.com/t/Azure-DevOps-Pipeline-not-triggered-for-/1400393

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 1
    I have verified that it works when I merge a PR that does not contain any `[skip ci]` commits. So the trigger itself is functional. – ivoh Apr 14 '21 at 07:52
  • @ivoh, So, what you mean "When we merge the PR to master it does NOT trigger the CI trigger at all"? the pipeline will be triggered after we complete the PR, then the pipeline will be triggered for the CI. – Leo Liu Apr 14 '21 at 08:07
  • @ivoh, Based on your trigger setting, this pipeline will be triggered two times, one is triggered by PR Trigger during PR, `pr: - master`, and another is CI for the master branch after PR completed. Am I right? If not, please share the detailed steps for reproduce this issue and some images will be better. – Leo Liu Apr 14 '21 at 08:14
  • Yes you are corret. This pipeline is triggered twice: once when a PR targeting master is opened (this deploys to acceptance env), and once when the PR targeting master is merged (which *should* deploy to production). If you still want pictures, what would you like to have pictures of? – ivoh Apr 14 '21 at 10:02
  • I have added the commit log to the original post, I hope that helps as well. – ivoh Apr 14 '21 at 10:21
  • 1
    @ivoh, Thanks for the info. I have almost reproduced your issue. If I use the Github as repo, a PR merged with a [skip ci] commit on develop branch but not on PR, it does not trigger CI master branch. But the PR trigger works fine. Do you have the same behavior? I also test it with Azure devops Git repo, I got the different result, I think this may a issue for Github repo. I need to confirm this. – Leo Liu Apr 15 '21 at 09:59
  • 1
    @ivoh, I have updated the answer with more info about this issue and I have report this issue to the Product team, if I have any process for this, I will let you know as soon as possible. – Leo Liu Apr 16 '21 at 08:11
  • Yes, that is my exact issue. For your final question "So, we are not sure if this is an issue or default behaver.": I think this is at the very least unexpected behaviour, as it would imply that once you have a [skip ci] commit anywhere in your merge history, your merge will never trigger, which seems dubious to me.Either way, I have circumvented this issue for now (see my own answer), so at least our team can continue. Thank you for your help so far! – ivoh Apr 16 '21 at 11:18
  • 1
    @ivoh, Yes, I agree with you. This should also be an unexpected behaviour for me. I am confirming with Product team, you could check this ticket https://developercommunity.visualstudio.com/t/Azure-DevOps-Pipeline-not-triggered-for-/1400393 for the feedback. – Leo Liu Apr 19 '21 at 02:19
0

I have now circumvented this issue by removing the [skip ci] commit and using some exclude path filters on the the CI triggers.

This introduces some other minor issues, but for now this works for us. Obviously this isn't a real solution, so I won't mark anything as an answer for now.

ivoh
  • 21
  • 4