-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
fix(CI): properly configure cancel duplicates #12625
Conversation
Codecov Report
@@ Coverage Diff @@
## master #12625 +/- ##
==========================================
- Coverage 67.01% 66.80% -0.21%
==========================================
Files 1022 1022
Lines 50102 50102
Branches 5191 5191
==========================================
- Hits 33574 33469 -105
- Misses 16397 16502 +105
Partials 131 131
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
816db71
to
67861ae
Compare
67bdfdb
to
4ad214a
Compare
0cf38da
to
bf893a5
Compare
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.
LGTM. I wish there was a way to avoid copying the action into the codebase 🙁
2a4e5c7
to
d918bdc
Compare
@potiuk, thanks for making the awesome cancel-workflow-runs GitHub action! Could you check here if I used your action correctly? Much appreciated! |
d918bdc
to
c167c98
Compare
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.
It can be done a bit simpler (and without error state). You can use results of the previous step in the conditional execution of the cancel one.
Submodules works great for it! |
6144c6c
to
f5218b4
Compare
echo "Found $count unfinished jobs." | ||
echo "::set-output name=count::$count" | ||
|
||
- uses: potiuk/cancel-workflow-runs@953e057dc81d3458935a18d1184c386b0f6b5738 |
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.
Just refer to it locally same as for other actions
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.
And add the checkout removed above (otherwise it won't work)
BTW. This is not necessarily true. If you have a lot of jobs in the queue and EACH of the jobs triggers "cancel" on their own, you do not need to add schedule. Whenever any of the scheduled jobs gets in the queue it will cancel all runs. And if there are no jobs in the queue, then ..... you have nothing to cancel because there are no jobs in the queue. So those scheduled cancels will only increase number of jobs but IMHO they will not increase the chance of cancel step actually running. BTW. Remember that scheduled runs are also put in the queue. If you have a lot of jobs in the queue they will be added at the end of the queue. So there is little point in running them really for this case. This was the main design decision behind "cancelAllDuplicates" behaviour - to go through all runs and cancel all duplicates. |
You are right. It's not like the scheduled run can insert in between the long list of checks once a PR is filed. I'll revise. |
f5218b4
to
dfc623d
Compare
@potiuk, good to see you here! and thanks for |
6ab5f6f
to
29e3713
Compare
HOLD: current configuration seems to be only cancelling the Cancel Duplicates job itself: https://github.com/ktmud/superset/runs/1771801161?check_suite_focus=true |
597b020
to
adf6d70
Compare
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.
looking forward for this one
CI is a living hell right now
notifyPRCancel: true | ||
skipEventTypes: '["push", "pull_request", "pull_request_target"]' | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
notifyPRCancel: false |
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.
I believe since you are trying to cancel other workflows, you need to specify also
workflowFileName
parameter and specify the workflow run file name that you want to cancel.
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.
If you need to cancel more than one worklfow, you need to copy the step and use different workflowFileName
,
adf6d70
to
98f43c2
Compare
98f43c2
to
d6d02c8
Compare
@potiuk , thanks for the additional information! I decided to extend a previous Python script I wrote that was intended to use locally. Now it's working properly: https://github.com/ktmud/superset/runs/1783573660?check_suite_focus=true Also updated the PR description to include the intended effect. |
@villebro @amitmiran137 could you take another look on this one? I've completely changed how the jobs are cancelled. More details in PR description. |
@@ -23,13 +23,13 @@ | |||
export GITHUB_TOKEN=394ba3b48494ab8f930fbc93 |
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.
Just wondering Is this a real github token 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.
Nope. I just randomly typed one that look real.
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.
A real token has 40 characters, this one has 24.
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.
LGTM
workflows: ["CI"] | ||
types: ["requested"] | ||
workflows: | ||
- "Miscellaneous" |
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.
so once merge and will work only with Miscellaneous workflow then we'll add all workflows here right?
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.
Only this workflow will trigger the cancel job, but a scheduled cancel job will try to cancel duplicates of all workflows.
I just tested this |
many thanks for improving the CI process! cc @guhan |
SUMMARY
Updating the "Cancel Duplicates" job to use our own Python script, which will try to cancel all duplicate jobs of all workflows:
pull_request
orpush
).The benefit of using a custom Python script instead of a black-box like 3rd party action is that even if the cancel workflow is blocked be other long-running jobs scheduled before it, committers can still run the script locally to trigger the cancellation.
Tried to use https://github.com/potiuk/cancel-workflow-runs#most-often-used-canceling-example
but it's not very easy to configure.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TEST PLAN
The job should start correctly and duplicate runs should be properly cancelled.
Tested on my personal fork.
Check https://github.com/ktmud/superset/actions?query=workflow%3A%22Cancel+Duplicates%22 or verification.
ADDITIONAL INFORMATION