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

KAFKA-18636 Fix how we handle Gradle exits in CI #18681

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

mumrah
Copy link
Member

@mumrah mumrah commented Jan 23, 2025

This patch removes usages of ignoreFailures in our CI and changes the XML copy task to a finalizer task instead of doLast closure. Also fixes a fall-through case in junit.py where we did not recognize an error prior to running the tests (such as the javadoc task).


Since we are running our CI Gradle commands with --continue, we should not normally need to explicitly ignoreFailures in the test tasks. After all, that's what --continue does (ignore failures from tasks). The reason we included it was to ensure our doLast closure was always run. When a test task fails, the main task action will fail and prevent any doLast or other later parts of the task action from running.

Instead of copying out the test XML in a doLast, we can use a finalizer task. A finalizer task will run regardless of task outcome. This is a bit nicer than what we were doing.

This patch also removes the non-standard exit behavior of the ":test" task. Previously, we were explicitly causing this task to fail if any test failed. This was done to prevent the results from being cached if there were flaky test runs. However, since trunk is the only CI job to write to the cache, and trunk always runs all tests (i.e., does not load the cache), it should be safe to allow caching if there were flaky tests. In fact, this should do nothing but help our PR run times as it will increase cache hits.

Here are the possible outcomes of our ":test" and ":quarantinedTest" tasks:

Test results Task result Gradle exit junit.py exit
No failures 0 0 0
Flaky failures 0 0 0
Too many flaky 1 1 1
Error (no tests run) N/A 1 1

This not only simplifies the mapping of task outcomes to exit codes, but it aligns more closely with the way Gradle is designed and how the Develocity plugin works.

@github-actions github-actions bot added the build Gradle build or GitHub Actions label Jan 23, 2025
@mumrah
Copy link
Member Author

mumrah commented Jan 24, 2025

With the javadoc error reintroduced, the build now shows

There was an error during the test or quarantinedTest task. Please check the logs
Error: Process completed with exit code 1.

https://github.com/apache/kafka/actions/runs/12938661800/job/36089513936?pr=18681

@mumrah mumrah requested a review from chia7712 January 24, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Gradle build or GitHub Actions clients
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant