-
Notifications
You must be signed in to change notification settings - Fork 368
Fix empty dts panic #7116
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
Merged
khanhtc1202
merged 2 commits into
pipe-cd:master
from
vishnukothakapu:fix-empty-dts-panic
Aug 22, 2026
Merged
Fix empty dts panic #7116
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
Still, do we need to validate it here, after validating deployTargets in the plugin?go (run function)? cc @armistcxy
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.
Yes, we still need this check here. The validation in
plugin.goonly verifies that the plugin itself has deploy targets configured.dtNamescomes from the individual app’s deployment request, so an app can still send an empty targets list. Without this check, we’d pass an emptydeployTargetsslice to stage execution and hit the samedts[0]panic this PR is meant to prevent.So this check is needed to return a clean
InvalidArgumenterror for that case.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.
@khanhtc1202 yes anh, I have checked and as what @vishnukothakapu said, we need to check in both places
The first one in the plugin's Run function is for when starting the plugin
The next ones are for each application deployment (I've just checked that you can create an application without deploy target through Web UI)
Evidence: it can cause panic when you trigger new deployment for the application with no deploy target

TL,DR: Yes, we still need because validate in plugin running != validate in executing stage in application's deployment
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.
But there's one part I still concern @vishnukothakapu
Your fix check the
dtNames, but the one we actually pass to the functionexecuteStageisdeployTargetsSo there will be a bug like this, in application configuration we specify deploy target
ecs-devBut in piped.yaml we specify deploy target as
ecs-targetThere will be mismatch =>
len(deployTargets)= 0Maybe you should do something like if len(deployTargets) ==0 then log error like "Mismatch deploy target between plugin and application, or no specified deploy target in application configuration"
CC anh @khanhtc1202
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.
Thanks for checking this! @armistcxy .
Actually, if there is a mismatch (e.g., the application asks for
ecs-devbut the plugin only hasecs-target), the code inside the for loop will hit the !ok condition and immediately return an error:return nil, status.Errorf(codes.Internal, "the deploy target %s is not found in the piped plugin config", name)Because it returns this error immediately, it never proceeds to
executeStagewith an empty deployTargets slice.If len(dtNames) > 0, len(deployTargets)is guaranteed to be greater than 0, otherwise it fails safely before execution. So we are completely covered for the mismatch scenario!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.
@vishnukothakapu Oh I see, sorry for false alert, then I think it's all good now