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

Produce proper exit status in case image has been built with timeout #35282

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Oct 30, 2023

When we build the image with timeout, we fork the process and set alarm
and create a new process group in order to be sure that all the parallel
build processes can be killed easily with sending termination signal to
process group on timeout. In order to wait for the forked process
to complete we used waitpid, but we did not handle the status code
properly, so if the build failed, we returned with 0 exit code.

This had the side effect that "Build CI image" did not fail, instead
the next step (generating source providers failed instead and it was
not obvious that the CI image build failing was the root cause.

This PR properly retrieves the wait status and converts it to
exit code - since we are still supporting Python 3.8 this is still
done using a bit nasty set of if statements - only in Python 3.9 we
have os.waitstatus_to_exitcode method to do it for us, but we cannot
use the method yet.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@potiuk potiuk force-pushed the test-failing-composite-action branch 2 times, most recently from 1ce7ede to b335391 Compare October 30, 2023 20:51
@potiuk potiuk added the use public runners Makes sure that Public runners are used even if commiters creates the PR (useful for testing) label Oct 30, 2023
@potiuk potiuk force-pushed the test-failing-composite-action branch 10 times, most recently from 127c56b to 07c5312 Compare October 31, 2023 02:01
@potiuk potiuk changed the title Testing Produce proper exit status in case image has been built with timeout Oct 31, 2023
@potiuk potiuk marked this pull request as ready for review October 31, 2023 02:02
When we build the image with timeout, we fork the process and set alarm
and create a new process group in order to be sure that all the parallel
build processes can be killed easily with sending termination signal to
process group on timeout. In order to wait for the forked process
to complete we used waitpid, but we did not handle the status code
properly, so if the build failed, we returned with 0 exit code.

This had the side effect that "Build CI image" did not fail, instead
the next step (generating source providers failed instead and it was
not obvious that the CI image build failing was the root cause.

This PR properly retrieves the wait status and converts it to
exit code - since we are still supporting Python 3.8 this is still
done using a bit nasty set of if statements - only in Python 3.9 we
have `os.waitstatus_to_exitcode` method to do it for us, but we cannot
use the method yet.
@potiuk potiuk force-pushed the test-failing-composite-action branch from 07c5312 to 2328bcf Compare October 31, 2023 02:04
@potiuk potiuk removed the use public runners Makes sure that Public runners are used even if commiters creates the PR (useful for testing) label Oct 31, 2023
Copy link
Contributor

@V0lantis V0lantis left a comment

Choose a reason for hiding this comment

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

Nice catch

@potiuk potiuk merged commit 92c2c3f into main Oct 31, 2023
66 of 67 checks passed
@potiuk potiuk deleted the test-failing-composite-action branch November 17, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants