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

spike: Comments in devfile.yaml not preserved when using Devfile library #919

Closed
rm3l opened this issue Aug 30, 2022 · 3 comments
Closed
Labels
area/library Common devfile library for interacting with devfiles kind/enhancement New feature or request lifecycle/rotten Rotten items. These items have been stale for 60 days and are now closed. lifecycle/stale Stale items. These items have not been updated for 90 days.

Comments

@rm3l
Copy link
Member

rm3l commented Aug 30, 2022

/kind bug

Which area this bug is related to?

/area library

What versions of software are you using?

Operating System:
Fedora 36

Go Pkg Version:

Bug Summary

Describe the bug:

odo commands (like odo add binding or odo remove binding commands) that edit the devfile.yaml file will save the Devfile without comments preserved.
A first investigation on the odo side led me to the Devfile library, which uses sigs.k8s.io/yaml, which in turn relies on JSON as an intermediate format to convert YAML to/from Go structs.

To Reproduce:
See the test cases added in the following repo: https://github.com/rm3l/devfile-lib-comment-preservation-issue.

To reproduce the issue using odo, see redhat-developer/odo#5789 (comment) instead.

Expected behavior

Comments are preserved. I think this is important as we want the Devfile to be the main source of truth in odo. So users that write ("carefully crafted") comments should have their comments always preserved.

Any logs, error output, screenshots etc? Provide the devfile that sees this bug, if applicable.

Additional context

Any workaround?
No workaround so far.

Suggestion on how to fix the bug
go-yaml v3 brought in comment handling, via a new Node representation that allows preserving comments near the data they describe.
So the recommended way to have comments preserved is via this Node representation, but I guess this will not allow consistent handling of both YAML and JSON.

As we discussed during a community call, other tools might need JSON handling as well.

@openshift-ci openshift-ci bot added kind/bug Something isn't working area/library Common devfile library for interacting with devfiles labels Aug 30, 2022
@yangcao77 yangcao77 added kind/enhancement New feature or request and removed kind/bug Something isn't working labels Sep 6, 2022
@rm3l rm3l changed the title Comments in devfile.yaml not preserved when using Devfile library (via odo) Comments in devfile.yaml not preserved when using Devfile library Sep 12, 2022
@valaparthvi
Copy link

/title Comments in devfile.yaml and the order is not preserved when writing to Devfile using the library

@Jdubrick Jdubrick moved this to Refinement in Devfile Project Feb 28, 2024
@johnmcollier johnmcollier changed the title Comments in devfile.yaml not preserved when using Devfile library spike: Comments in devfile.yaml not preserved when using Devfile library Apr 10, 2024
@johnmcollier
Copy link
Member

Converting issue to spike to investigate feasibility

@johnmcollier johnmcollier moved this from Refinement to Backlog in Devfile Project Apr 10, 2024
Copy link

github-actions bot commented Aug 1, 2024

This issue is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 60 days.

@github-actions github-actions bot added the lifecycle/stale Stale items. These items have not been updated for 90 days. label Aug 1, 2024
@github-actions github-actions bot added the lifecycle/rotten Rotten items. These items have been stale for 60 days and are now closed. label Oct 1, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@github-project-automation github-project-automation bot moved this from Backlog to Done ✅ in Devfile Project Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/library Common devfile library for interacting with devfiles kind/enhancement New feature or request lifecycle/rotten Rotten items. These items have been stale for 60 days and are now closed. lifecycle/stale Stale items. These items have not been updated for 90 days.
Projects
Status: Done ✅
Development

No branches or pull requests

4 participants