-
Notifications
You must be signed in to change notification settings - Fork 93
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
save config api for upgrade service #4681
save config api for upgrade service #4681
Conversation
f86b6a3
to
500848e
Compare
c71219c
to
0912496
Compare
3c4353d
to
e759d7f
Compare
Co-authored-by: Salah Al Saleh <[email protected]>
@@ -141,8 +142,23 @@ func Run(appID string, appSlug string, sequence int64, isAirgap bool, archiveDir | |||
var preflightErr error | |||
defer func() { | |||
if preflightErr != nil { | |||
err := setPreflightResult(appID, sequence, &types.PreflightResults{}, preflightErr) | |||
preflightResults := &types.PreflightResults{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about combining this with the setResults
function below? it can also be defined outside of entire function to make it smaller. same for setProgress.
pkg/preflight/execute.go
Outdated
@@ -18,7 +18,7 @@ import ( | |||
|
|||
// Execute will Execute the preflights using spec in preflightSpec. | |||
// This spec should be rendered, no template functions remaining | |||
func Execute(preflightSpec *troubleshootv1beta2.Preflight, ignorePermissionErrors bool, setProgress func(progress map[string]interface{}) error, setResults func(results *types.PreflightResults) error) (*types.PreflightResults, error) { | |||
func Execute(preflightSpec *troubleshootv1beta2.Preflight, ignorePermissionErrors bool, setProgress func(progress map[string]interface{}) error, setResults func(results *types.PreflightResults, runError error) error) (*types.PreflightResults, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is runError
param needed here?
preflightData, err := getPreflightData() | ||
if err != nil { | ||
return errors.Wrap(err, "failed to get preflight data") | ||
} | ||
preflightData.Results = results | ||
if runError != nil { | ||
if preflightData.Results.Errors == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry to be nit picky, but to be consistent with the other implementation, let's update results
before updating preflightData.Results
. would probably look cleaner.
What this PR does / why we need it:
This PR adds an API endpoint to the upgrade service for saving config. The handler will trigger preflights to run in the background after successfully saving the config and rendering the base archive.
Which issue(s) this PR fixes:
https://app.shortcut.com/replicated/story/105494/upgrade-service-api-side-of-the-config-page-in-the-deployment-wizard
Special notes for your reviewer:
Steps to reproduce
Does this PR introduce a user-facing change?
Does this PR require documentation?