-
Notifications
You must be signed in to change notification settings - Fork 849
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
[New builder] Introduce Cancelot #271
[New builder] Introduce Cancelot #271
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome, I'm installing from your fork today!
.gitignore
Outdated
@@ -0,0 +1 @@ | |||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm not 100% sure, just added it cause I was using Goland for it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I can't imagine we would want to check in intellij config directories, there's no extant gitignore so I'd leave it out of this commit.
@rharter Hey, sry for pinging you, but do you maybe know if there is anyone from Google checking this repo? 😞 It seems like there has been some inactivity. |
Hey @nof20, I've tested this out and it works great (and fixes a pain point I've had for some time, causing me to manually cancel builds when I discover 🤦♂️ errors when reviewing the diff while posting a PR). Any chance we can push it along? I'm happy to help how I can. |
A feature request for cancelot, could you add the option to look for a specific tag instead of branch? It seems like |
@viktorvoltaire sure, this is something that could be done! How would you expect it to work through? Have either Branch name or tag expected and terminate in case none is declared or both are declared? |
Well as long as branch_name is not mandatory, since it can't be filtered on when using the github app, im happy :) |
Will see what I can have ready in the end of the week ! |
@pavlospt unfortunately my feature request might not be valid due to limitations in cloudbuild. One cant have special characters like |
@viktorvoltaire yes, this is indeed a limitation which caused some trouble for us as well. |
Is it an issue to run a regex replace over the |
I haven't been able to solve tags are specified and evaluated before running build steps and seems to be static. @jthegedus do you have a solution that works? |
@viktorvoltaire there is |
No that is empty. |
@viktorvoltaire just to be sure I am up-to-date which Github app are you referring to? |
@sanastos would it be possible to take a look at this one as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, although I recommend adding an example that exercises this behavior (I guess two builds, one that hangs, one that cancels). This will reduce the likelihood that a future maintainer will accidentally break this.
.gitignore
Outdated
@@ -0,0 +1 @@ | |||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I can't imagine we would want to check in intellij config directories, there's no extant gitignore so I'd leave it out of this commit.
@sanastos I do not think that this is something doable, because the work done by Cancelot is based on different builds triggered with different UUIDs, which means there will be no way to check if things will break unfortunately :/ |
@sanastos I removed the |
Ah, I see what you're saying. This only cancels triggered builds, and there's no easy way to fake that. Well, as a bare minimum, how about a test like:
And then a README.md that instructs you to launch as: Alternatively just hard code a fake branch name in the This at least exercises the code a bit, better than nothing. |
@sanastos sure will add your suggestions tomorrow then! |
Looks good, thanks for your contribution. And kudos on the cool name 💯 |
Love the concept, but is there any way to specify which repository this should actually apply to? Right now it just cancels all running builds if a new one comes in no matter the source. |
@Kampe this takes into account branch name. Do you happen to have duplicate branch names between different repos? If so please file it as an issue and i will prepare a PR to handle this case as well! |
Background
After trying out CloudBuild we needed a way to cancel any running builds for the same branch when we were pushing a new commit, in order to avoid billing extra not needed minutes. Since CloudBuild does not offer an out of the box solution we built
Cancelot
.How it works
Cancelot will be invoked when the build starts and will try to find any running jobs that match the following filter:
Usage
Add the builder as the first step in your project's
cloudbuild.yaml
: