-
Notifications
You must be signed in to change notification settings - Fork 312
feat: enhance deploy and destroy pipelines with dependency handling #4725
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
Conversation
- Added support for managing dependencies in both deploy and destroy commands. - Introduced flags to control redeployment and destruction of dependencies. - Updated pipeline mutations to include an `isDependency` argument for better context handling. - Enhanced logging and error handling for dependency operations. This update improves the flexibility and control over dependency management during pipeline operations. Signed-off-by: Javier Lopez <javier@okteto.com>
@@ -746,6 +746,7 @@ func (dc *Command) deployDependencies(ctx context.Context, deployOptions *Option | |||
} | |||
} | |||
} | |||
oktetoLog.SetStage("") |
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 this needed? Have you tested it in all the cases?
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.
cmd/pipeline/deploy.go
Outdated
@@ -66,6 +67,7 @@ type deployFlags struct { | |||
skipIfExists bool | |||
reuseParams bool | |||
redeployDependencies bool | |||
dependenciesIsSet bool |
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.
I don't think this should be in the deployFlags
. This is not something that comes from the options selected by the user. It is something calculated based on user's input. I would not mix things. We already did that in the past and it generated issues
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.
I wanted to follow the same approach as we have in the deploy command, but I agree that we should completely remove it and only use it on the options
cmd/pipeline/destroy.go
Outdated
@@ -124,7 +130,23 @@ func (pc *Command) ExecuteDestroyPipeline(ctx context.Context, opts *DestroyOpti | |||
return nil | |||
} | |||
|
|||
func (pc *Command) destroyPipeline(ctx context.Context, name, namespace string, destroyVolumes, destroyDependencies bool) (*types.GitDeployResponse, error) { | |||
func shouldDestroyDependencies(opts *DestroyOptions) bool { | |||
isForceRedeployDependenciesSetInOktetoInstance := env.LoadBoolean(constants.OktetoForceDestroyDependencies) |
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.
We don't have yet the code in the CLI to set this OktetoForceDestroyDependencies
based on the server information, right?
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.
This variable comes from the backend in the same way as OKTETO_FORCE_REMOTE
does for the remote flag
Signed-off-by: Javier Lopez <javier@okteto.com>
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (59.52%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #4725 +/- ##
==========================================
- Coverage 48.80% 48.79% -0.02%
==========================================
Files 354 354
Lines 29638 29673 +35
==========================================
+ Hits 14466 14479 +13
- Misses 14019 14037 +18
- Partials 1153 1157 +4 🚀 New features to boost your workflow:
|
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.
Approved as it is looking good, but please, review the 2 comments to make more readable (in my opinion) the functions that check if the redeploy should apply or not
- Streamlined the logic for determining whether to redeploy or destroy dependencies based on user flags. - Improved readability by reducing nested conditions and clarifying the flow of decision-making. This change enhances the maintainability of the code related to dependency management in pipeline operations. Signed-off-by: Javier Lopez <javier@okteto.com>
isDependency
argument for better context handling.This update improves the flexibility and control over dependency management during pipeline operations.
Proposed changes
Fixes DEV-961
This PR fixes the infinite redeployment when the setting is activated in the backend
How to validate
okteto pipeline deploy/destroy
with dependencies and without themCLI Quality Reminders 🔧
For both authors and reviewers: