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

devfile validation fails if folder name is not valid #4305

Closed
gorkem opened this issue Dec 13, 2020 · 2 comments · Fixed by #4333
Closed

devfile validation fails if folder name is not valid #4305

gorkem opened this issue Dec 13, 2020 · 2 comments · Fixed by #4333
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@gorkem
Copy link
Contributor

gorkem commented Dec 13, 2020

/kind bug

What versions of software are you using?

Operating System:
MacOs

Output of odo version:

odo 2.0.3

How did you run odo exactly?

odo push

Actual behavior

When I run odo push on a folder with devfile. devfile validation fails with the following.
the staticHTML is the name of the folder and I never set a component name.
I think odo is setting the component name from folder name without converting it to be vaid.

❯ odo push

Validation
 ✗  Failed to start component with name staticHTML. Error: Failed to create the component: component name "staticHTML" is not valid, component name should conform the following requirements: 
- Contain at most 63 characters
- Contain only lowercase alphanumeric characters or ‘-’
- Start with an alphanumeric character
- End with an alphanumeric character
- Must not contain all numeric values

Expected behavior

validation does not fail

Any logs, error output, etc?

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 13, 2020
@kadel
Copy link
Member

kadel commented Dec 14, 2020

I think odo is setting the component name from folder name without converting it to be vaid.

Yes, that is what is happening here :-(

odo needs to convert the directory name into the always valid component name.
odo needs to do the following cleanup before using value as a component name:

  1. convert to lowercase
  2. remove all non-alphanumeric characters except -
  3. if it is all numeric values, prepend it with x
  4. remove all leading and trailing non-alphanumeric characters (because of the 2. step, this can be only -)

@girishramnani
Copy link
Contributor

I can take a look at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants