Open mojavelinux opened 5 years ago
The answer to this question appears to be no. The include/exclude filters for branches only consider APPVEYOR_REPO_BRANCH, not APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH. Unfortunately, this means that the job will run for a merge/pull request even though it wouldn't run on the same branch in the upstream.
Here's the difference in events when I push the same branch (docs/exclude-me) to the upstream vs send it as a merge/pull request.
Upstream branch
Commit "d52fcf21" skipped as branch "docs/exclude-me" is in black-list
Job: All
Documentation: https://www.appveyor.com/docs/branches/#white--and-blacklisting
Branches black-list:
/^docs\/./
Commit message: does it work?
Merge/pull request branch
Build version 1 created
Branch: master
Commit ID: 7877085abd4c16b5b3dc5f583fd3beebd9ed3d73
(Also a bit strange that the exclusion event doesn't report the full commit ID).
@mojavelinux you are correct and you found correct issue (https://github.com/appveyor/ci/issues/2402#issuecomment-45001701). However that issue is mostly about implementing file-based filtering for GitLab. Will this work for you? I mean files in the doc
folder are most probably .md
ones or something similar and you can describe them with regex.
If this is what can help you, we can force this issue resolution.
I think these are separate concerns. On the one hand, there are docs MRs that, no matter what they contain, shouldn't run a job (or at least a specific build configuration). On the other hand, there is skipping a build if there were no files that matched one of the patterns (whether or not it's a docs build).
Having branch filtering is an easy way to partition branches to have different flows. A docs branch has a fundamentally different flow than a code branch.
I don't see why you can't just use the exclude to look for either the source or target branch. If the exclusion matched either, the build should be skipped.
I agree. This is a valid scenario.
As a temporary workaround you can forcibly exit the build if APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH
matches certain condition. This will still fire a build and set a status, but at least it will not consume concurrent jobs time.
As a temporary workaround you can forcibly exit the build if APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH matches certain condition.
Aha! I was looking for that! Thanks for the tip.
I was excited to learn that AppVeyor rolled out support for GitLab merge requests. I was able to get it working in no time. Thank you!
However, I'm struggling to implement a more advanced use case.
I'd like to configure AppVeyor to skip certain merge requests. In particular, I want to exclude the merge request if it comes from a branch name that matches a particular pattern (e.g.,
docs/*
).Here's the configuration I'm using, which clearly indicates that branches which match the pattern
/^docs\/./
should be excluded:https://gitlab.com/antora/antora/blob/master/.appveyor.yml
However, here's AppVeyor running on a merge request that should have been excluded based on that rule:
https://ci.appveyor.com/project/antora/antora/builds/21201559
Is there something wrong with my configuration? Or is this not possible?