Skip to content
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

ENH - Run schema validation during qhub init #1267

Closed
iameskild opened this issue May 4, 2022 · 7 comments
Closed

ENH - Run schema validation during qhub init #1267

iameskild opened this issue May 4, 2022 · 7 comments

Comments

@iameskild
Copy link
Member

We are currently only running schema validation when qhub render is called. Let's move this sort of validation as early in the process as we can.

Here is any example of the qhub init passing but qhub render failing a validation check that should be caught earlier in the process, as part of this failed gh action:

$ qhub init "do" --project "test--do-github-actions" --domain "do.qhub.dev" --auth-provider github --disable-prompt --ci-provider github-actions
$ qhub render -c "qhub-config.yaml" -o "qhub-do-github-actions-deployment"

Error: The schema validation of the qhub-config.yaml failed. The following error message may be helpful in determining what went wrong:

1 validation error for Main
project_name
  
        In order to successfully deploy QHub, there are some project naming conventions which need
        to be followed. First, ensure your name is compatible with the specific one for
        your chosen Cloud provider. In addition, the QHub project name should also obey the following
        format requirements:
        - Letters from A to Z (upper and lower case) and numbers;
        - Maximum accepted length of the name string is [16](https://github.com/Quansight/qhub/runs/6178700354?check_suite_focus=true#step:10:16) characters.
        - If using AWS: names should not start with the string "aws";
        - If using Azure: names should not contain "-".
        
Maximum accepted length of the project name string is 16 characters. (type=value_error)
Error: Process completed with exit code 1.

Related to #761

@viniciusdc
Copy link
Contributor

Thanks for raising this @iameskild, I agree that having those checks as earlier as possible would be great. Though would we like those tests to be managed all by pydantic schema as we are doing for render? Another way of doing this would be to separate those validations to another python script and call those methods when needed in the schema and in the initialize.

@viniciusdc
Copy link
Contributor

@tonyfast do you have any ideas how could we use pydantic schema here? the code which we should validate is:

  • here we defined the args that qhub init accepts;
  • here we generated the qhub-config based on a template;

@viniciusdc
Copy link
Contributor

Once we get to a PR for this, we can update the naming convention that was missing for AWS (see comment)

@trallard
Copy link
Member

@iameskild @asmijafar20 is this being covered in your current PR?

@asmijafar20
Copy link
Contributor

Yes, @trallard.

@iameskild
Copy link
Member Author

In this PR, we are currently validating most of the inputs that are being passed in when running nebari init ... but there are a few more checks that should be added. Unfortunately most of the remaining checks are scattered throughout qhub/initialize.py and need to be moved to qhub/schema.py.

@trallard trallard changed the title Run schema validation during qhub init ENH - Run schema validation during qhub init Jan 12, 2023
@iameskild
Copy link
Member Author

We are now performing validations during the init process. This was added during the large extension mechanism refactor.

@github-project-automation github-project-automation bot moved this from New 🚦 to Done 💪🏾 in 🪴 Nebari Project Management Oct 16, 2023
@github-project-automation github-project-automation bot moved this from Needs refinement 🪨 to Done 💪🏾 in 🗃 - Nebari backlog Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done 💪🏾
Development

No branches or pull requests

5 participants