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

osbuild-worker: improve error "reason" in case of stage failures (HMS-1442) #4113

Merged
merged 2 commits into from
Jul 9, 2024

Conversation

schuellerf
Copy link
Contributor

This should improve the error in the frontend from

stage_error_before

to

stage_error_after

There is no test framework to test changes like this, right?

@schuellerf schuellerf changed the title osbuild-worker: improve error "reason" in case of stage failures osbuild-worker: improve error "reason" in case of stage failures (HMS-1442) Apr 30, 2024
@schuellerf
Copy link
Contributor Author

Note: related issues: #4137 and #4145

bcl
bcl previously approved these changes Jun 10, 2024
Copy link
Contributor

@bcl bcl left a comment

Choose a reason for hiding this comment

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

Looks good

@schuellerf schuellerf force-pushed the improve_stage_error_message branch 2 times, most recently from ed43026 to 5b2a520 Compare June 17, 2024 10:34
@schuellerf schuellerf enabled auto-merge (rebase) June 17, 2024 10:35
@bcl bcl force-pushed the improve_stage_error_message branch from 5b2a520 to f33129b Compare June 18, 2024 00:14
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you for improving this! I wonder if we should take the opportunity (maybe in a followup if you prefer) to extract a helper here and write a test. The current Run() function is very long and does a lot of things so extracting a helper will not helper that much but it's a start. Wdyt about something like:

0001-osbuild-worker-extract-makeJobErrorFromOsbuildOutput.patch.txt

as a starting point, there is a lot of room for improvement here but this feels like we could build more on top (and also could be used as an example to e.g. extract the logging too etc.

But happy to do as a followup of course!

@schuellerf schuellerf force-pushed the improve_stage_error_message branch 2 times, most recently from 42e0b17 to f849321 Compare June 19, 2024 15:47
@schuellerf schuellerf force-pushed the improve_stage_error_message branch from f849321 to 28aa517 Compare July 4, 2024 15:19
@schuellerf
Copy link
Contributor Author

Also fixes osbuild/images#727

@schuellerf schuellerf requested a review from bcl July 4, 2024 15:28
@schuellerf schuellerf force-pushed the improve_stage_error_message branch 2 times, most recently from d84797c to 3ccd4f5 Compare July 5, 2024 08:09
@schuellerf schuellerf force-pushed the improve_stage_error_message branch from 3ccd4f5 to 8028bbf Compare July 5, 2024 10:53
as now the .Reason is properly passed over - it was printed twice
@schuellerf schuellerf force-pushed the improve_stage_error_message branch from 8028bbf to 53a5707 Compare July 8, 2024 07:42
@schuellerf schuellerf requested a review from mvo5 July 8, 2024 12:03
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Let's merge it, I would like to get back to workerClientErrorFrom() but this PR improves things a lot so let's get it merged :)

cmd/osbuild-worker/jobimpl-osbuild.go Show resolved Hide resolved
cmd/osbuild-worker/jobimpl-osbuild.go Show resolved Hide resolved
cmd/osbuild-worker/jobimpl-osbuild_test.go Show resolved Hide resolved
cmd/osbuild-worker/jobimpl-osbuild_test.go Show resolved Hide resolved
cmd/osbuild-worker/jobimpl-depsolve.go Show resolved Hide resolved
@schuellerf schuellerf merged commit 7cd5abd into osbuild:main Jul 9, 2024
42 checks passed
mvo5 added a commit to mvo5/osbuild-composer that referenced this pull request Jul 10, 2024
Small followup for
osbuild#4113 (comment)

Given that the failed stage is a relatively short string the `\n`
seems unneccessary and quotes are enough.
thozza pushed a commit that referenced this pull request Jul 11, 2024
Small followup for
#4113 (comment)

Given that the failed stage is a relatively short string the `\n`
seems unneccessary and quotes are enough.
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.

5 participants