Closed zephraph closed 6 years ago
Hey @eddiewebb! I think this is good to go. If there's anything you'd like me to change, please let me know. This will make our release process much, much smoother. I just wish it was a built in feature of CircleCI. 😄
First;y, thank you! This is a great PR with tests and all!
I want to make sure there is not a bug in my existing logic.
The existing consider_branch
is intended to work as such:
But in your case it sounds like you have a deploy
job that can run on all branches, and concurrency is fine there as long as its not master?
We probably ought to merge the two as only-on-branch: *
is the same as consider_branch: false
( i think)
They're close, but not exactly the same.
Our deploy step only runs on master via a CircleCI filter.
filters:
branches:
only:
- master
The issue is, on master we want to queue the entire workflow. So we have to have an entry queue job that waits for no other workflows in master to be running before executing. We do this because in our deploy
workflow, there are commits that are made. Those commits won't trigger a new ci build (they use [no ci]
in the commit messages), but we want to avoid any weird timing issues with git.
Now, I tried to make all the jobs of the workflow depend on queue
and have queue
also filter to only run on master
. That doesn't work though. As a matter of fact, if you do that CircleCI doesn't give any visual indication via the UI that the job tried to run at all. I mean, it makes sense... you're saying the entry job shouldn't run and having jobs depend on that entry job.... but still, it makes it kinda impossible to do what I need to do.
So in this case, I don't necessary care about the value of consider_branch
because I only ever want the queue to run on master
. In that case I'd set only-on-branch
to master
.
They do different things. Only on branch means never queue unless you're on a specific branch. Whereas consider_branch means only queue the job for this branch if another branch like this one is running the same job. That could technically happen across multiple branches though.
I was trying to use this in https://github.com/artsy/reaction/pull/1481 and I ran into an issue where I only needed it to run on master, but I didn't really have a good way of achieving that. If you look back in the commits in that PR you'll see where I tried to make all the steps require before our
deploy
job depend on apre-deploy
job that was filtered to only run on master... turns out, that just makes none of them run.