zenml icon indicating copy to clipboard operation
zenml copied to clipboard

Add zenml stack recipe CLI commands

Open wjayesh opened this issue 2 years ago • 1 comments

Describe changes

  • This PR introduces the zenml stack recipe CLI commands that allow the following functionalities.

    • zenml stack recipe list: List all available stack recipes.
    • zenml stack recipe pull <recipe-name>: Pull a recipe to your local filesystem.
    • zenml stack recipe deploy <recipe-name>: Deploy a specific stack recipe and auto-import the resoures created, as a ZenML stack.
    • zenml stack recipe destroy <recipe-name>: Destroy all resources created by a recipe.
    • zenml stack recipe clean: Deletes the pulled recipes from the local filesystem.

    This feature has been inspired by the zenml example commands and expects a run_recipe.sh file inside each recipe directory to create the resources and a destroy_recipe.sh file to destroy them.

  • Option to force-import a stack YAML with a different version than the current ZenML version.

Pre-requisites

Please ensure you have done the following:

  • [x] I have read the CONTRIBUTING.md document.
  • [x] If my change requires a change to docs, I have updated the documentation accordingly.
  • [ ] If I have added an integration, I have updated the integrations table and the corresponding website section.
  • [ ] I have added tests to cover my changes.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Other (add details above)

wjayesh avatar Jul 28 '22 09:07 wjayesh

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

While reading though the code I wasn'T entirle sure how the terraform outputs are parsed into the stack yaml, specifically the secrets. How would that be handled in the current version of the code?

@AlexejPenner The parsing of the terraform outputs into a stack YAML is done as part of a stack recipe itself and is not handled here at all. The secret outputs can be accessed individually by running terraform output <var-name> inside the stack recipe directory. I've added the instructions for it in the code, as you suggested. I'm planning to create secrets directly as part of the recipe going forward. It would require changes only at the stack recipe level and can thus be handled independently of our release cycles.

It might be worth a thought removing all the non-cli related code into a separate file, but I do understand that this is a similar case to the examples which we have handled similarly until now.

I think that since the Terraform code is only used inside the stack_recipes CLI, it would be okay to place it in the same file as the commands. However, I'm open to putting it separately as I agree it would look cleaner but can't decide on a suitable home for it. Do you have any potential candidates in mind?

wjayesh avatar Aug 13 '22 17:08 wjayesh