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

When script fails with exit code 1 we want to see the reason in logs #106

Merged

Conversation

andywaltlova
Copy link
Collaborator

@andywaltlova andywaltlova commented Dec 1, 2023

Use case: problem in conversion script when script exited with 1 but we had to manually reproduce the situation to see which part of code was problematic

Related to oamg/convert2rhel-insights-tasks#46

@codecov-commenter
Copy link

codecov-commenter commented Dec 1, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (ed055ae) 64.58% compared to head (2b2c2a8) 64.20%.
Report is 2 commits behind head on main.

Files Patch % Lines
src/runner.go 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #106      +/-   ##
==========================================
- Coverage   64.58%   64.20%   -0.39%     
==========================================
  Files           5        5              
  Lines         336      338       +2     
==========================================
  Hits          217      217              
- Misses         99      101       +2     
  Partials       20       20              
Flag Coverage Δ
go-1.19 64.20% <25.00%> (-0.39%) ⬇️
go-1.20 64.20% <25.00%> (-0.39%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andywaltlova andywaltlova force-pushed the feat/use-combinedoutput-for-collection branch from b891f61 to b94f7ad Compare December 1, 2023 07:57
@andywaltlova andywaltlova requested a review from r0x0d December 1, 2023 08:00
@andywaltlova andywaltlova force-pushed the feat/use-combinedoutput-for-collection branch from b94f7ad to cbcd0b2 Compare December 1, 2023 08:32
Use case: problem in covnersion script when script exited with 1 but we had to manually reproduce the situation to see which part of code was problematic

Signed-off-by: Andrea Waltlova <[email protected]>
@andywaltlova andywaltlova force-pushed the feat/use-combinedoutput-for-collection branch from cbcd0b2 to 2905cb0 Compare December 1, 2023 10:05
@andywaltlova
Copy link
Collaborator Author

I will wait with this one, I want to test it locally in vagrant box to make sure the error and exit code don't fail, we would have to make new release anyway.

@andywaltlova andywaltlova changed the title When script fails with exit code 1 we want to see the reson in logs When script fails with exit code 1 we want to see the reason in logs Dec 5, 2023
as per logs and tests in vagrant box if script exits with one it is contained in the er itself

Signed-off-by: Andrea Waltlova <[email protected]>
@andywaltlova
Copy link
Collaborator Author

Alright, looks alright to me! Below is the log when I made syntax error in python script (=makes the execution end with exit code 1), I removed the duplicate exit status log from this MR since it is in the err itself. @r0x0d can I merge it? :)

[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 server.go:44: Processing received yaml data
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:39: WARNING: Playbook verification disabled.
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:118: Writing temporary script to /var/lib/rhc-worker-script
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:123: Processing script ...
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:126: Executing script...
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:84: Successfully set env variable  RHC_WORKER_CONVERT2RHEL_DISABLE_TELEMETRY
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/grpc.go:172: dispatched message eb61d4c9-8bf1-442f-ad12-05ddf05f17f2 to worker rhc-worker-script
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:132: Failed to execute script:  exit status 1
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:135: Exit code:  1
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 runner.go:138:   File "/var/lib/rhc-worker-script/rhc-worker-script99561753", line 539
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker]     def update_insights_inventory()
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker]                                   ^
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] SyntaxError: invalid syntax
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker]
[rhcd] 2023/12/05 09:19:30 /builddir/build/BUILD/rhc-0.2.0/cmd/yggd/exec.go:59: [/usr/libexec/rhc/rhc-script-worker] 2023/12/05 09:19:30 server.go:48: Creating payload for message eb61d4c9-8bf1-442f-ad12-05ddf05f17f2

@r0x0d
Copy link
Member

r0x0d commented Dec 5, 2023

@andywaltlova, please go ahead. I'm afraid that this won't land in the worker for quite some time now. I think we can only do a release next year as we are out of time for pushing any releases right now.

@andywaltlova andywaltlova merged commit 1bb05b6 into oamg:main Dec 5, 2023
@r0x0d r0x0d mentioned this pull request Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants