nebari
nebari copied to clipboard
Run schema validation during `qhub init`
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
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.
@tonyfast do you have any ideas how could we use pydantic schema here? the code which we should validate is:
Once we get to a PR for this, we can update the naming convention that was missing for AWS (see comment)
@iameskild @asmijafar20 is this being covered in your current PR?
Yes, @trallard.
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
.
We are now performing validations during the init process. This was added during the large extension mechanism refactor.