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

Improve handling startup error on Piped #2732

Merged

Conversation

kurochan
Copy link
Contributor

@kurochan kurochan commented Nov 3, 2021

What this PR does / why we need it:
Handle execution loop error.

Which issue(s) this PR fixes:

Fixes #2731

Does this PR introduce a user-facing change?:

Stop launcher immediately in case it's failed on the first start

Comment on lines 279 to 283
if err := execute(); err != nil {
input.Logger.Error("LAUNCHER: failed while checking whether relaunch required or relaunching. Skip the loop this time", zap.Error(err))
// Don't return an error to continue piped execution.
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

If you want to print out the error, making it print inside the execute() function is better since we have the cause in detail and can print the error log more clearly.

Copy link
Contributor Author

@kurochan kurochan Nov 3, 2021

Choose a reason for hiding this comment

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

There already exists logging error detail inside execute(), Should I delete this logging?

Copy link
Member

Choose a reason for hiding this comment

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

And this return (with or without err) will stop the execution of the launcher and we don't want that, so I think it's better to keep the execution in this loop as is.

Copy link
Contributor Author

@kurochan kurochan Nov 3, 2021

Choose a reason for hiding this comment

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

this return will stop the execution of launcher

I made a mistake 😱 I'll fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed 3121014

@pipecd-bot pipecd-bot added size/XS and removed size/S labels Nov 3, 2021
@khanhtc1202
Copy link
Member

khanhtc1202 commented Nov 3, 2021

Piped got stuck when configuration with environment variables is invalid. I think it would be kinder to terminate the process startup fails.

According to the issue, I want to confirm something about the context. The docs around launcher and piped are still not good enough that cause misunderstanding but the thing started in your cluster looks like a launcher (which should continuously run and handle piped executions). The launcher will get the piped configuration on start and pass it as the configuration of the piped it starts. At the idea level, we want that launcher to run continuously (even with error on the piped side) such that it could start another piped with other configurations or versions. Of course, I understand your point of "in case the first execution failed, we should stop the launcher immediately and notice users about failure", so how do you think about "only stop (return err) in case of the first execution failed"? 🤔

Also, want other people's opinions.
About the launcher, please ref to docs

@nghialv
Copy link
Member

nghialv commented Nov 3, 2021

@kurochan Nice pull request. Thank you. 😍

@nghialv
Copy link
Member

nghialv commented Nov 3, 2021

@khanhtc1202

so how do you think about "only stop (return err) in case of the first execution failed"?

I think he already updated the PR to be like that.

@nghialv
Copy link
Member

nghialv commented Nov 3, 2021

/trigger presubmits

@pipecd-bot
Copy link
Collaborator

TRIGGER

@nghialv: Your requested presubmits has been scheduled in response to this comment.

@nghialv
Copy link
Member

nghialv commented Nov 3, 2021

/lgtm

@pipecd-bot pipecd-bot added the lgtm label Nov 3, 2021
@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.14%. This pull request decreases coverage by -0.00%.

File Function Base Head Diff
pkg/app/launcher/cmd/launcher/launcher.go launcher.run 0.00% 0.00% +0.00%

Co-authored-by: Khanh Tran <32532742+khanhtc1202@users.noreply.github.com>
@pipecd-bot pipecd-bot removed the lgtm label Nov 3, 2021
@pipecd-bot
Copy link
Collaborator

GO_LINTER

The golinter build is completed with FAILURE. The build will be triggered again when you push any other commits. Or you can trigger it manually by /golinter trigger command right now.

You can check the build log from here.

@khanhtc1202
Copy link
Member

/golinter trigger

@pipecd-bot
Copy link
Collaborator

GO_LINTER

The golinter build is completed with FAILURE. The build will be triggered again when you push any other commits. Or you can trigger it manually by /golinter trigger command right now.

You can check the build log from here.

@khanhtc1202
Copy link
Member

/trigger presubmits

@pipecd-bot
Copy link
Collaborator

TRIGGER

@khanhtc1202: Your requested presubmits has been scheduled in response to this comment.

@khanhtc1202
Copy link
Member

Looks like @pipecd-bot takes his rest today 🏖️

@pipecd-bot
Copy link
Collaborator

COVERAGE

Code coverage for golang is 32.14%. This pull request decreases coverage by -0.00%.

File Function Base Head Diff
pkg/app/launcher/cmd/launcher/launcher.go launcher.run 0.00% 0.00% +0.00%

@khanhtc1202
Copy link
Member

Nice improvement 👍
/approve

@pipecd-bot
Copy link
Collaborator

APPROVE

This pull request is APPROVED by khanhtc1202.

Approvers can cancel the approval by writing /approve cancel in a comment. Any additional commits also will change this pull request to be not-approved.

@pipecd-bot pipecd-bot merged commit 6f17af7 into pipe-cd:master Nov 3, 2021
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.

Improve handling startup error on Piped
4 participants