nebari icon indicating copy to clipboard operation
nebari copied to clipboard

[ENH] - Include "force" flag to upgrade command CLI

Open viniciusdc opened this issue 1 year ago • 3 comments

Feature description

For standardization, having a flag for our upgrade command will be beneficial in forcing the acceptance of upgrade options while updating the cluster. This will be useful when we are doing some CI testing.

Value and/or benefit

CI benefitial

Anything else?

No response

viniciusdc avatar Oct 09 '24 10:10 viniciusdc

Hi @viniciusdc, how have you been? As I'm working on DevOps practices, I would love to work on this issue but can you please give me some more context? What I have understood from you description is that:

  • The --force flag will automatically accept upgrade prompts, bypassing manual confirmation.
  • It is useful for CI pipelines to automate the upgrade process without user intervention.
  • It speeds up testing and ensures upgrades can proceed in automated environments.
  • Overall, it streamlines CI/CD processes by allowing the upgrade command to run without manual input.

Suraj-kumar00 avatar Oct 09 '24 10:10 Suraj-kumar00

Hey @Suraj-kumar00!

Sorry for the late reply. Your interest in this issue is very welcome!

  • The --force flag will automatically accept upgrade prompts, bypassing manual confirmation.
  • It is useful for CI pipelines to automate the upgrade process without user intervention.
  • It speeds up testing and ensures upgrades can proceed in automated environments.
  • Overall, it streamlines CI/CD processes by allowing the upgrade command to run without manual input.

Your understanding is correct. If you take a look at the upgrade.py file, you'll notice that we have an upgrade step for each version, where we prompt the user depending on what needs to be done. While there are some cases where no action is required from the user, there are other cases where the user needs to decide whether they should nebari to run operations on their behalf. See, for example, https://github.com/nebari-dev/nebari/blob/215bbd622f0ea1692e79bb4411db81ef28b1d329/src/_nebari/upgrade.py#L1032-L1036

The idea of having a --force flag is to clearly define what the default behavior should be, without any user input, to upgrade Nebari. That will allow us to run automatic upgrade tests in our CI/CD workflows and improve our confidence in the changes we incorporate.

There's currently a PR ready to be reviewed implementing the logic to add these automatic upgrade tests to our GHA workflows. You'll notice it's actually using the nebari upgrade command and passing the --attempt-fixes flag: https://github.com/nebari-dev/nebari/blob/09e34a5e3f3fa48062f0ec64a430f2ab973d4fb7/.github/workflows/test_local_upgrade.yaml#L73

This would be the equivalent of having a --force flag and is already implemented and fully exposed to the upgrade steps. For example: https://github.com/nebari-dev/nebari/blob/3f2523aae801fa5d09c414aec6fe1eb237effc0f/src/_nebari/upgrade.py#L485-L494

Now, what we need to do, is to make sure that recent upgrade steps that prompt the user for input can be run automatically by defining a default logical path using this flag.

Let me know if you're still interested in contributing a fix for this issue and I'll be happy to answer any questions you might have.

@viniciusdc does it make sense to edit the issue body and title to reflect the fact that we don't need an extra flag as we already have one implemented? It's just a matter of actually using it on the existing and coming upgrade steps.

marcelovilla avatar Oct 24 '24 19:10 marcelovilla

@viniciusdc does it make sense to edit the issue body and title to reflect the fact that we don't need an extra flag as we already have one implemented? It's just a matter of actually using it on the existing and coming upgrade steps.

Yes, I think it does. The renaming will still be kept in history if needed.

viniciusdc avatar Oct 24 '24 21:10 viniciusdc

Hey @Suraj-kumar00. Just reaching out to see if you're still interested in picking up this issue.

marcelovilla avatar Nov 01 '24 09:11 marcelovilla

@smokestacklightnin, why don't you go ahead and pick up this issue?

marcelovilla avatar Nov 08 '24 09:11 marcelovilla