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

[BUG] - project name validation #1813

Closed
pmeier opened this issue May 18, 2023 · 2 comments · Fixed by #2003
Closed

[BUG] - project name validation #1813

pmeier opened this issue May 18, 2023 · 2 comments · Fixed by #2003
Labels
area: nebari-cli good first issue Good for newcomers needs: PR 📬 This item has been scoped and needs to be worked on project: JATIC Work item needed for the JATIC project type: bug 🐛 Something isn't working
Milestone

Comments

@pmeier
Copy link
Member

pmeier commented May 18, 2023

Describe the bug

During nebari init --guided-init we are checking the project name in two places:

  1. When putting it in with

    def project_name_convention(value: typing.Any, values):

  2. While rendering the config with

    nebari/nebari/initialize.py

    Lines 360 to 363 in 8bd56f9

    if not re.match(namestr_regex, namespace):
    raise ValueError(
    "namespace should contain only letters and hyphens/underscores (but not at the start or end)"
    )

Unfortunately, these methods diverge:

  1. nebari/nebari/schema.py

    Lines 520 to 529 in 8bd56f9

    convention = """
    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 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 characters.
    - If using AWS: names should not start with the string "aws";
    - If using Azure: names should not contain "-".
    """
  2. namestr_regex = r"^[A-Za-z][A-Za-z\-_]*[A-Za-z]$"

Some differences (not exhaustive):

    1. allows numbers while 2. doesn't
    1. allows a maximum of 16 characters, while 2. allows arbitrary lengths
    1. has extra rules depending on the cloud provider, while 2. does not
    1. doesn't allow underscores or hyphens, while 1. does (it is not mentioned in the docstring, but it does)

Expected behavior

If a project name passes the initial validation, there should be no errors down the line.

OS and architecture in which you are running Nebari

How to Reproduce the problem?

Command output

No response

Versions and dependencies used.

No response

Compute environment

None

Integrations

No response

Anything else?

No response

@pmeier pmeier added type: bug 🐛 Something isn't working needs: triage 🚦 Someone needs to have a look at this issue and triage labels May 18, 2023
@pavithraes pavithraes added area: nebari-cli needs: PR 📬 This item has been scoped and needs to be worked on and removed needs: triage 🚦 Someone needs to have a look at this issue and triage labels May 22, 2023
@pavithraes pavithraes added the good first issue Good for newcomers label May 22, 2023
@pavithraes
Copy link
Member

@iameskild - Potential solution could be to check project name separately for each cloud provider. This is also blocked by the extension mechanism work.

@pavithraes pavithraes added the status: blocked ⛔️ This item is on hold due to another task label Jun 19, 2023
@iameskild iameskild added this to the Release 2023.9.1 milestone Aug 28, 2023
@iameskild iameskild added the project: JATIC Work item needed for the JATIC project label Aug 28, 2023
@pavithraes pavithraes removed the status: blocked ⛔️ This item is on hold due to another task label Sep 12, 2023
@kenafoster
Copy link
Contributor

I've created two related issues around project naming conventions

#2001
#2002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: nebari-cli good first issue Good for newcomers needs: PR 📬 This item has been scoped and needs to be worked on project: JATIC Work item needed for the JATIC project type: bug 🐛 Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

4 participants