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

Commands editing the devfile (like odo add binding or odo remove binding) reorder it #5119

Open
kadel opened this issue Oct 5, 2021 · 5 comments
Labels
area/registry Issues or PRs related to Devfile registries kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/Low Nice to have issue. It's not immediately on the project roadmap to get it done.

Comments

@kadel
Copy link
Member

kadel commented Oct 5, 2021

when using odo 2.4.0 (and 2.3.1 as well)

▶ odo create java-springboot
Devfile Object Validation
 ✓  Checking devfile existence [21080ns]
 ✓  Creating a devfile component from registry: DefaultDevfileRegistry [33560ns]
Validation
 ✓  Validating if devfile name is correct [29220ns]

Please use `odo push` command to create the component with source deployed

Devfile keys are sorted alphabetically, but they should be in the order as they are in original file

▶ cat devfile.yaml
commands:
- exec:
    commandLine: mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true
    component: tools
    group:
      isDefault: true
      kind: build
  id: build
- exec:
    commandLine: mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run
    component: tools
    group:
      isDefault: true
      kind: run
  id: run
- exec:
    commandLine: java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n
      -jar target/*.jar
    component: tools
    group:
      isDefault: true
      kind: debug
  id: debug
components:
- container:
    endpoints:
    - name: 8080-tcp
      targetPort: 8080
    image: quay.io/eclipse/che-java11-maven:next
    memoryLimit: 768Mi
    mountSources: true
    volumeMounts:
    - name: m2
      path: /home/user/.m2
  name: tools
- name: m2
  volume:
    size: 3Gi
metadata:
  description: Spring Boot® using Java
  displayName: Spring Boot®
  globalMemoryLimit: 2674Mi
  icon: https://spring.io/images/projects/spring-edf462fec682b9d48cf628eaf9e19521.svg
  language: java
  name: java-springboot-spring-petcl-egpl
  projectType: spring
  tags:
  - Java
  - Spring
  version: 1.1.0
schemaVersion: 2.0.0
starterProjects:
- git:
    remotes:
      origin: https://github.com/odo-devfiles/springboot-ex.git
  name: springbootproject

when using 2.3.0

▶ odo create java-springboot
Devfile Object Validation
 ✓  Checking devfile existence [20670ns]
 ✓  Creating a devfile component from registry: DefaultDevfileRegistry [33010ns]
Validation
 ✓  Validating if devfile name is correct [20070ns]
cat de	
Please use `odo push` command to create the component with source deployed

Devfile is in the same format as it is in devfile registry

▶ cat devfile.yaml ```yaml schemaVersion: 2.0.0 metadata: name: java-springboot version: 1.1.0 displayName: Spring Boot® description: Spring Boot® using Java tags: ['Java', 'Spring'] globalMemoryLimit: 2674Mi icon: https://spring.io/images/projects/spring-edf462fec682b9d48cf628eaf9e19521.svg projectType: 'spring' language: 'java' starterProjects: - name: springbootproject git: remotes: origin: 'https://github.com/odo-devfiles/springboot-ex.git' components: - name: tools container: image: quay.io/eclipse/che-java11-maven:next memoryLimit: 768Mi mountSources: true endpoints: - name: '8080-tcp' targetPort: 8080 volumeMounts: - name: m2 path: /home/user/.m2 - name: m2 volume: size: 3Gi commands: - id: build exec: component: tools commandLine: 'mvn clean -Dmaven.repo.local=/home/user/.m2/repository package -Dmaven.test.skip=true' group: kind: build isDefault: true - id: run exec: component: tools commandLine: 'mvn -Dmaven.repo.local=/home/user/.m2/repository spring-boot:run' group: kind: run isDefault: true - id: debug exec: component: tools commandLine: 'java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=${DEBUG_PORT},suspend=n -jar target/*.jar' group: kind: debug isDefault: true



/kind bug
/priority low



@openshift-ci openshift-ci bot added kind/bug Categorizes issue or PR as related to a bug. priority/Low Nice to have issue. It's not immediately on the project roadmap to get it done. labels Oct 5, 2021
@kadel kadel added the area/registry Issues or PRs related to Devfile registries label Oct 5, 2021
@scottkurz
Copy link
Contributor

Not sure if this is relevant but similar net impact: devfile/api#371

@kadel
Copy link
Member Author

kadel commented Oct 6, 2021

Not sure if this is relevant but similar net impact: devfile/api#371

yes, this is definitely related. The reordering is done by devfile/library.

But prior to odo v2.3.1 odo create was just downloading devfile.yaml without unmarshaling/marshalling cycle.
But something changed and now odo probably parses the devfile in memory and then saves it.

I think that #5115 and #5112 are another side effects if this.
All this could be related

@tmds
Copy link
Member

tmds commented Oct 28, 2021

Devfile keys are sorted alphabetically, but they should be in the order as they are in original file

Also: newlines should be maintained between (at least the) top-level sections.

@github-actions
Copy link
Contributor

A friendly reminder that this issue had no activity for 90 days. Stale issues will be closed after an additional 30 days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 31, 2023
@rm3l
Copy link
Member

rm3l commented Oct 31, 2023

/retitle Commands editing the devfile (like odo add binding or odo remove binding) reorder it
/lifecycle frozen

odo create no longer exists in v3. But this issue still applies to current commands that can edit the Devfile, like odo add binding or odo remove binding.
Related to #5789

@openshift-ci openshift-ci bot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 31, 2023
@openshift-ci openshift-ci bot changed the title odo create reorders devfile Commands editing the devfile (like odo add binding or odo remove binding) reorder it Oct 31, 2023
@openshift-ci openshift-ci bot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/registry Issues or PRs related to Devfile registries kind/bug Categorizes issue or PR as related to a bug. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/Low Nice to have issue. It's not immediately on the project roadmap to get it done.
Projects
Status: No status
Development

No branches or pull requests

4 participants