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

Add YAML 1.2 support #3811

Closed
7 tasks done
ssbarnea opened this issue Oct 4, 2023 · 0 comments
Closed
7 tasks done

Add YAML 1.2 support #3811

ssbarnea opened this issue Oct 4, 2023 · 0 comments
Assignees
Labels

Comments

@ssbarnea
Copy link
Member

ssbarnea commented Oct 4, 2023

While working on #3790 I was able to uncover a longer queue of issues that needs to be addressed.

Facts

  • pyyaml only supports YAML 1.1 and that is what ansible-core is using and 1.2 support is unlikely to see the light in a foreseeable future.
  • ruamel.yaml also supports YAML 1.2
  • if we dump ansible YAML documents using YAML 1.2 syntax, they will still be readable because YAML 1.2 is backwards compatible
  • Github Workflows use strict YAML 1.2 syntax and loading them with 1.1 loader and rewriting them will break them, this being the cause of Make yaml reformatting compatible with github workflows (on keyword) #3790 bug
  • Because we guess if an YAML file is owned by ansible or not, we are forced to first load the file in order to determine that, so this means that we might have to reload files to switch the loader or we would be stuck with 1.1 forever.

Tasklist

  • Add support for different YAML versions for kind and possible base_kind, so we could choose to use different loaders
  • Make guess_kind method usable from loader to avoid recursivity issues when loading files
  • ensure github-workflows use yaml-1.2 loader
  • ensure ansible-files use yaml-1.1 loader
  • allow to configure default loader version to use for YAML files for which we do not know which loader to use
  • do not write yaml version directive when rewriting files unless it was present initially as many loaders will break if they find it
  • Rewrite YAML loading logic to default to ruyaml and only use pyyaml for ansible-related files (opposite to current behavior).
@ssbarnea ssbarnea added new Triage required bug labels Oct 4, 2023
@ssbarnea ssbarnea self-assigned this Oct 4, 2023
@ssbarnea ssbarnea moved this to In Progress in 🧰 devtools project board Oct 4, 2023
@audgirka audgirka removed the new Triage required label Oct 18, 2023
@ssbarnea ssbarnea closed this as completed Nov 6, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Done in ansible-lint --fix Nov 6, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 🧰 devtools project board Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Archived in project
Development

No branches or pull requests

2 participants