Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Ignore failures from unbottled formulae#691

Merged
carlocab merged 6 commits intoHomebrew:masterfrom
carlocab:ignore-failures
Nov 10, 2021
Merged

Ignore failures from unbottled formulae#691
carlocab merged 6 commits intoHomebrew:masterfrom
carlocab:ignore-failures

Conversation

@carlocab
Copy link
Copy Markdown
Member

@carlocab carlocab commented Nov 5, 2021

This completes #687. It's not enough to call skipped because some
steps will still have a :failed status, and that will cause test-bot
to exit with an error.

@MikeMcQuaid
Copy link
Copy Markdown
Member

steps will still have a :failed status, and that will cause test-bot
to exit with an error.

Which ones? I'd rather those steps were also skipped rather than us ignoring failures.

@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 5, 2021

The ones we skipped. Doing skipped doesn't make the :failed status go away; it just adds the formula to the @skipped_or_failed_formulae array.

Here's an example: https://github.com/Homebrew/homebrew-core/runs/4115979271?check_suite_focus=true#step:7:177

@MikeMcQuaid
Copy link
Copy Markdown
Member

Doing skipped doesn't make the :failed status go away

Yeh, I don't think it should. I think it should still show up as "FAILED". If the issue is the exit code: can we handle that instead?

@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 5, 2021

Hmmm, we could. Let me have a look.

This completes Homebrew#687. It's not enough to call `skipped` because some
steps will still have a `:failed` status, and that will cause `test-bot`
to exit with an error.
@carlocab carlocab changed the title Ignore failures from formulae with unbottled dependents Ignore failures from unbottled formulae Nov 5, 2021
@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 5, 2021

I haven't been able to work out how to handle the exit code without tweaking the @status a bit, but the changes I'm about to push should still show FAILED in log when something fails, because of

@status = result.success? ? :passed : :failed
puts_result

and

def puts_result
puts Formatter.headline(Formatter.error("FAILED"), color: :red) if failed?
end

The next time @status is read is when determining the exit code, so it seems that that's the only sensible way to handle that.

@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 6, 2021

I believe the exit code is determined here:

Homebrew.failed = !TestRunner.run!(tap, git: GIT, args: args)

which comes from

failed_steps.empty?

so I don't currently see a sensible way of changing the exit code without changing some steps to not become :failed. I've tried to minimise the steps I'm doing this for to the minimum required. I'll also add some output at the end to indicate that some failures were ignored.

@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 9, 2021

I've updated this to handle build/linkage/test failures for unbottled dependents too.

The idea is to downgrade all these errors into warnings that will still display failure messages but won't cause test-bot to exit with an error. I'm thinking it might be helpful to get @BrewTestBot to post comments on a PR about warnings in the CI log to indicate that they should be looked at, since no one will read the logs otherwise when CI is green.

@SMillerDev
Copy link
Copy Markdown
Member

I'm thinking it might be helpful to get @BrewTestBot to post comments on a PR about warnings in the CI log to indicate that they should be looked at, since no one will read the logs otherwise when CI is green.

I believe Jenkins used to do this and it made the issue overview so much easier.

@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 9, 2021

I was wondering why @BrewTestBot stopped doing that. We could maybe roll our own, but there's the issue of access to secrets on PR branches.

@Bo98
Copy link
Copy Markdown
Member

Bo98 commented Nov 9, 2021

warnings in the CI log to indicate that they should be looked at, since no one will read the logs otherwise when CI is green.

Would GitHub Actions annotations help? Like the CI coverage annotations we have in Homebrew/brew.

@carlocab
Copy link
Copy Markdown
Member Author

carlocab commented Nov 9, 2021

They would help, yes. Easier to miss than comments, but better than hidden away behind a green CI log.

@MikeMcQuaid
Copy link
Copy Markdown
Member

Yeh, I think something like that would be ideal for adding warnings 👍🏻

- use `#blank?` instead of `#empty?`
- prefer `if` to `unless`

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
@carlocab carlocab merged commit 5537c45 into Homebrew:master Nov 10, 2021
@carlocab carlocab deleted the ignore-failures branch November 10, 2021 01:22
carlocab added a commit to carlocab/homebrew-test-bot that referenced this pull request Nov 10, 2021
This got misplaced while refactoring in Homebrew#691.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants