8000 feat: enhance deploy and destroy pipelines with dependency handling by jLopezbarb · Pull Request #4725 · okteto/okteto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 3 commits into from
May 30, 2025

Conversation

jLopezbarb
Copy link
Contributor
  • 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.

Proposed changes

Fixes DEV-961

This PR fixes the infinite redeployment when the setting is activated in the backend

How to validate

  1. Using a cluster set the redeploy dependencies to true and try running okteto pipeline deploy/destroy with dependencies and without them

CLI Quality Reminders 🔧

For both authors and reviewers:

  • Scrutinize for potential regressions
  • Ensure key automated tests are in place
  • Build the CLI and test using the validation steps
  • Assess Developer Experience impact (log messages, performances, etc)
  • If too broad, consider breaking into smaller PRs
  • Adhere to our code style and code review guidelines

- 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>
@jLopezbarb jLopezbarb requested a review from a team as a code owner May 28, 2025 17:16
@@ -746,6 +746,7 @@ func (dc *Command) deployDependencies(ctx context.Context, deployOptions *Option
}
}
}
oktetoLog.SetStage("")
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could have done it as part of another PR but it's needed because when redeploying we introduce one of the information message from the following dependency on the same stage as the previous one. I opted to include it here since it was a small fix
Screenshot 2025-05-29 at 12 49 52

@@ -66,6 +67,7 @@ type deployFlags struct {
skipIfExists bool
reuseParams bool
redeployDependencies bool
dependenciesIsSet bool
Copy link
Member

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

Copy link
Contributor Author

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

@@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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>
Copy link
codecov bot commented May 29, 2025

Codecov Report

Attention: Patch coverage is 59.52381% with 17 lines in your changes missing coverage. Please review.

Project coverage is 48.79%. Comparing base (71efd0b) to head (8cf9ef0).
Report is 2 commits behind head on master.

❌ 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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member
@ifbyol ifbyol left a 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>
@jLopezbarb jLopezbarb merged commit 756791b into master May 30, 2025
11 of 13 checks passed
@jLopezbarb jLopezbarb deleted the jlo/dev-961-using-backend branch May 30, 2025 08:08
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.

2 participants
0