-
Hi there! I am using github actions as the CI/CD tool to run automated test cases on a given application. I have been struggling for a while with the I want this to be done at all times, meaning that even when the step for the suite run fails, I want this step to happen to check the results. To achieve that I am forced to use the There is however some days where the plaftorm I use as test management tool is down or slow. When this happens this step that uses the always tag just keeps on running. I’ve tried the cancelation thourgh the cancel workflow button or even runnning the command Is it possible to have a force cancel workflow? If not, given I use a private repo, I will pay for extra minutes when I am not taking advantage of the tool. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 30 replies
-
You might consider setting a timeout on your workflow. This came up recently, and doesn’t appear to be well documented, so someone should file a bug. https://docs.github.com/en/actions/learn-github-actions/expressions#always In short, You might be able to use |
Beta Was this translation helpful? Give feedback.
-
This is really weird behavior. If I cancel a job or a workflow I expect it to, you know, cancel. If I only cancel the jobs that that job depends on, it makes sense that it would run anyway, but if I do something to cancel that job itself, it is super unintuitive that it would not cancel |
Beta Was this translation helpful? Give feedback.
-
This
This decision is hard to understand as a user |
Beta Was this translation helpful? Give feedback.
-
So... once we hit this, how do we finally cancel a job that is already on that situation? |
Beta Was this translation helpful? Give feedback.
-
Some workaround for topic, you need use not custom_condition:
if: always() && !cancelled()
runs-on: ubuntu-latest
steps:
- run: echo "Hello world"
- run: sleep 30 |
Beta Was this translation helpful? Give feedback.
-
For anyone stuck with an uncancellable run, you can use |
Beta Was this translation helpful? Give feedback.
-
How is no one here getting |
Beta Was this translation helpful? Give feedback.
-
I now seem to have an un-cancellable workflow that doesn't use |
Beta Was this translation helpful? Give feedback.
-
Am I misunderstanding something or shouldn't I even put this Debug-functional-if:
name: Debug Functional if
runs-on: [self-hosted, wolf]
needs: [Build-RPM, Import-commit-message, Calc-rpm-build-matrix, Import-commit-pragmas,
Import-commit-pragmas2]
strategy:
matrix:
distro: ${{ fromJSON(needs.Calc-rpm-build-matrix.outputs.matrix) }}
fail-fast: false
# NOTE: the always() here is generally bad practice as it makes jobs uncancellable
# we only use it here because it's for debugging only
if: always() || cancelled() || success() || failure()
steps:
- name: Is cancelled
if: cancelled()
run: echo "cancelled() == true"
- name: Is success()
if: success()
run: echo "success() == true"
- name: Is failure()
if: failure()
run: echo "failure() == true" which reports: And only runs at all because I added the |
Beta Was this translation helpful? Give feedback.
-
Is this really resolved? I think the overall behaviour is quite silly and unintuitive and suspect there are still edge cases that are not achievable. |
Beta Was this translation helpful? Give feedback.
You might consider setting a timeout on your workflow.
This came up recently, and doesn’t appear to be well documented, so someone should file a bug.
https://docs.github.com/en/actions/learn-github-actions/expressions#always
In short,
always()
steps aren’t cancelable.You might be able to use
success() || failure() || cancelled()
– I’m not sure ifcancelled()
has the same property.