[planpreview] Fix to avoid nil panic when executing plan preview#6224
Merged
Conversation
Signed-off-by: Yoshiki Fujikane <ffjlabo@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6224 +/- ##
==========================================
- Coverage 28.77% 28.77% -0.01%
==========================================
Files 559 559
Lines 59553 59565 +12
==========================================
Hits 17138 17138
- Misses 41100 41112 +12
Partials 1315 1315
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ffjlabo
commented
Sep 12, 2025
| logger.Info("will decide sync strategy for an application") | ||
|
|
||
| r := model.MakeApplicationPlanPreviewResult(*app) | ||
| result = model.MakeApplicationPlanPreviewResult(*app) |
Member
Author
There was a problem hiding this comment.
set the value for named return variable result
ffjlabo
commented
Sep 12, 2025
Comment on lines
+382
to
+398
| var ( | ||
| runningDS *deploysource.DeploySource | ||
| err error | ||
| ) | ||
| runningDS, err := runningDSP.Get(ctx, io.Discard) | ||
| if err != nil { | ||
| return model.SyncStrategy_PIPELINE, fmt.Sprintf("failed to get the running deploy source, %v", err) | ||
|
|
||
| if preCommit != "" { | ||
| runningDSP := deploysource.NewProvider( | ||
| b.workingDir, | ||
| deploysource.NewLocalSourceCloner(repo, "running", preCommit), | ||
| app.GitPath, | ||
| b.secretDecrypter, | ||
| ) | ||
| runningDS, err = runningDSP.Get(ctx, io.Discard) | ||
| if err != nil { | ||
| return model.SyncStrategy_PIPELINE, fmt.Sprintf("failed to get the running deploy source, %v", err) | ||
| } | ||
| } |
Member
Author
There was a problem hiding this comment.
abort nil runningDS when execting determineStrategy
ffjlabo
commented
Sep 12, 2025
Comment on lines
+402
to
+404
| var pRds *common.DeploymentSource | ||
| if runningDS != nil { | ||
| pRds = runningDS.ToPluginDeploySource() |
Member
Author
There was a problem hiding this comment.
pass runningDS as nil to plugin side
ffjlabo
commented
Sep 12, 2025
| name: name, | ||
| DeploymentServiceClient: deployment.NewDeploymentServiceClient(conn), | ||
| LivestateServiceClient: livestate.NewLivestateServiceClient(conn), | ||
| PlanPreviewServiceClient: planpreview.NewPlanPreviewServiceClient(conn), |
Member
Author
There was a problem hiding this comment.
init PlanPreviewServiceClient
t-kikuc
approved these changes
Sep 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
as title.
Fixed four points
resultWhy we need it:
We want to make plan preview work in pipedv1.
Which issue(s) this PR fixes:
Follow #6221
Does this PR introduce a user-facing change?: