Skip to content
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

.github: Set commit status to error when workflow are cancelled #16155

Merged
merged 1 commit into from Jun 28, 2021

Conversation

pchaigno
Copy link
Member

@pchaigno pchaigno commented May 14, 2021

GitHub jobs are usually set to status 'error' when cancelled. We should do the same for ci-xxx jobs when they are cancelled. Having the state appear as an error clarifies that the author, janitor, and reviewers should take notice of that workflow's result.

@pchaigno pchaigno added area/CI Continuous Integration testing issue or flake release-note/ci This PR makes changes to the CI. labels May 14, 2021
@pchaigno pchaigno requested a review from nbusseneau May 14, 2021 15:23
@pchaigno pchaigno requested review from a team as code owners May 14, 2021 15:23
@pchaigno pchaigno requested a review from aanm May 14, 2021 15:23
Copy link
Member

@nbusseneau nbusseneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can also happen for other automatic reasons (not yet determined)

Did you see this happen? The only case I've seen workflows get cancelled is when they hit the timeout, which is expected.

I personally still think both user cancellation and timeout cancellation resulting in pending is better than marking the job as failed, because when a job is cancelled it should simply be retriggered. Keeping it marked as pending makes it clearer IMO.

In any case, if we do want to move forward with marking jobs as failure, then I would recommend we instead just refactor both in the existing failure state by replacing:

- name: Set commit status to failure
  if: ${{ failure() }}

with

- name: Set commit status to failure
  if: ${{ !success() }}

(or failure() || cancelled())

@pchaigno
Copy link
Member Author

Did you see this happen? The only case I've seen workflows get cancelled is when they hit the timeout, which is expected.

I've seen this is https://github.com/cilium/cilium/actions/runs/836840304, and it is indeed because of the 30 minutes timeout. I was not aware that was a potential reason for cancellation.

I personally still think both user cancellation and timeout cancellation resulting in pending is better than marking the job as failed, because when a job is cancelled it should simply be retriggered. Keeping it marked as pending makes it clearer IMO.

Ideally, we'd have a cancelled status, but we don't :'-(. Marking timeouts as pending is very weird to me: it's a failure case and whoever is responsible for the PR should check it to see what happened. They should not just retry blindly. It's also a behavior that differs from what Jenkins does (and maybe from what GitHub itself does in pull_request events). In particular, for non-required GitHub checks, if I'm a janitor and I see them as pending, I'm likely to think the PR author just didn't trigger them because it was unnecessary.

We can raise this on Monday to get the opinion of more folks.

In any case, if we do want to move forward with marking jobs as failure, then I would recommend we instead just refactor both in the existing failure state by replacing:

👍 I'll make the change.

@stale

This comment has been minimized.

@stale stale bot added the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jun 18, 2021
@pchaigno pchaigno removed the stale The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale. label Jun 19, 2021
GitHub jobs are usually set to status 'error' when cancelled. We should
do the same for ci-xxx jobs when they are cancelled. Having the state
appear as an error clarifies that the author, janitor, and reviewers
should take notice of that workflow's result.

Signed-off-by: Paul Chaignon <paul@cilium.io>
@pchaigno pchaigno force-pushed the workflows-error-status-when-cancelled branch from 0999bf5 to bfe555b Compare June 28, 2021 15:59
@pchaigno pchaigno requested a review from a team as a code owner June 28, 2021 15:59
@pchaigno pchaigno requested a review from nbusseneau June 28, 2021 16:00
@pchaigno pchaigno added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Jun 28, 2021
@aanm aanm merged commit 51df515 into cilium:master Jun 28, 2021
@pchaigno pchaigno deleted the workflows-error-status-when-cancelled branch June 29, 2021 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI Continuous Integration testing issue or flake ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/ci This PR makes changes to the CI.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants