odo icon indicating copy to clipboard operation
odo copied to clipboard

odo should not require metadata.name in devfile

Open kadel opened this issue 3 years ago • 2 comments

User Story

  • As an odo user I have created a devfile without metadata section (devfile spec defines that whole metadata section as optional)
  • I want to be able to use such devfile with odo
  • This makes sense as if I have devfile inside my project repo metadata is not much use for me

Acceptance Criteria

  • [ ] if there is no metadata.name defined in devfile, use alizer to evaluate the component name
  • [ ] do all necessary sanitation to directory name before using it as a devfile name (length, allowed characters etc...)

/kind user-story

example

commands:
- exec:
    commandLine: npm install
    component: runtime
    group:
      isDefault: true
      kind: build
    workingDir: ${PROJECT_SOURCE}
  id: install
- exec:
    commandLine: npm start
    component: runtime
    group:
      isDefault: true
      kind: run
    workingDir: ${PROJECT_SOURCE}
  id: run
- exec:
    commandLine: npm run debug
    component: runtime
    group:
      isDefault: true
      kind: debug
    workingDir: ${PROJECT_SOURCE}
  id: debug
- exec:
    commandLine: npm test
    component: runtime
    group:
      isDefault: true
      kind: test
    workingDir: ${PROJECT_SOURCE}
  id: test
components:
- container:
    endpoints:
    - name: http-3000
      targetPort: 3000
    image: registry.access.redhat.com/ubi8/nodejs-14:latest
    memoryLimit: 1024Mi
    mountSources: true
  name: runtime
schemaVersion: 2.0.0

current behavior

 odo dev   
  __
 /  \__     Developing using the  Devfile
 \__/  \    Namespace: asdf
 /  \__/    odo version: v3.0.0-alpha3
 \__/

↪ Deploying to the cluster in developer mode
 ✗  Waiting for Kubernetes resources 
Cleaning resources, please wait
failed to delete inner loop resources: failed to get the resource "Deployment" name for component ""; cause: namespacing: component name cannot be blank ✗  failed to create the component: component name "" 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

kadel avatar Jun 13 '22 15:06 kadel

The fix for this issue should also include adding a common(central) way of obtaining the metadata name.

valaparthvi avatar Jul 07 '22 13:07 valaparthvi

Dependent on #5847

valaparthvi avatar Jul 20 '22 09:07 valaparthvi