-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC ignore branch whitelist for pull requests #2064
Comments
I'm certain that there's a detail how this change solves the issue that I'm not quite wrapping my head around, but I like the general goal of inhibiting the duplicate build. I've observed the behavior when working with repos where the workflow is feature branches vs. repo forks. In some cases, I've introduced additional event-based, typically related to "test" or "deploy" steps:
|
We are facing this issue as well. What we would expect is for the condition to do what it actually says which is to trigger only when the actual current branch is |
@rochdev I am a bit unclear. Can you provide a sample of your configuration and a more detailed explanation? |
@bradrydzewski Our configuration is: publish:
when:
branch: master We expected this to only run when the change is merged into master, but it was running in pull requests as well until we added an In summary, I would expect I think maybe the current behaviour could also be kept by adding something like (For reference, we use a feature branch + master flow) |
This proposal describes a behavior change to the top-level branches section, which is used to limit overall pipeline execution by branch [1], as opposed to per-step execution. I think you want to subscribe to #2222 instead.
Drone uses the target branch by design. Whether or not you think this is correct probably depends on your workflow. If you are using the github workflow (for which drone is optimized) you are forking and using feature branches. In this case, the existing implementation is optimal. Note that we previously used the source branch (in 0.4) and eventually changed to target branch based on community feedback. So if we changed this back (as suggested) it might work better for some and then worse for others.
I am open to tracking both source and target branch as described in #2222 and making these available as conditions. The branch field will continue to use the target branch for pull requests, since we want to avoid breaking changes of this magnitude unless absolutely necessary. |
+1 on exposing origin + target branches as condition. Maybe we even should have basic shell command conditions. To make more complicated conditions possible. Like evaluate pull request changed file extensions. And skip build if only txt, md etc. I would think about a service docker plugin that creates conditions that can be used in steps. |
moved to #2222 |
The yaml file has a branch filter:
I would like to consider ignoring this filter for pull request events.
The reason is that teams not using the github workflow (fork pull-request) will push to a branch with an open pull request, triggering two builds.
This change in logic would allow a team to whitelist branches (e.g. master) and push to feature branches with an open pull request, while only triggering a single build for the pull request, and not a second for the push. Note that merging the pull request would still trigger a build assuming it matches the branch whitelist.
I'm open to other solutions here as well ...
@jmccann @donny-dont @benschumacher hoping to get some thoughts. Does this make sense?
The text was updated successfully, but these errors were encountered: