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 support for YAML 1.2 #517

Open
3 tasks done
seabass-labrax opened this issue Nov 17, 2021 · 6 comments
Open
3 tasks done

Add support for YAML 1.2 #517

seabass-labrax opened this issue Nov 17, 2021 · 6 comments
Labels
feature add new functionality
Milestone

Comments

@seabass-labrax
Copy link
Contributor

Clear and concise description of the problem

It would be convenient to be able to use YAML 1.2 for .woodpecker.yml and other such workflow files. I believe many users are likely to assume that Woodpecker supports the latest version of YAML, but it currently supports only YAML 1.1 (which was published in 2005).

Adding an explicit version directive (%YAML 1.2) to .woodpecker.yml results in the CI not being run, and the CI status not being shown at all in the Gitea (Codeberg) user interface. Woodpecker's own user interface displays the following error message:

Execution error
yaml: line 3: found incompatible YAML document

This message is generated by the go-yaml library, in its yaml/parserc.go file.

Suggested solution

We could use a different YAML parsing library which does support YAML 1.2, or contribute support for YAML 1.2 upstream. This may be related to an existing issue and pull request relating to YAML support:

#352
#384

Alternative

We could also update the documentation to make it clear that only YAML 1.1 is supported. Currently, it is potentially confusing that the 'Getting Started' page on the Woodpecker documentation says that the format "is a superset of the widely used docker-compose file format", despite the fact that Docker Compose does support YAML 1.2.

Additional context

This is the error message I referred to earlier:

error-message

...and this is a pop-up message that appears if one tries to restart the failed build:
error-popup

Validations

@seabass-labrax
Copy link
Contributor Author

I'd be more than happy to lend a hand if you decide to take one of the options I described :)

@6543 6543 added feature add new functionality and removed pending:feature labels Nov 18, 2021
@anbraten
Copy link
Member

anbraten commented Nov 18, 2021

The yaml package supports most of YAML 1.2, but preserves some behavior from 1.1 for backwards compatibility.

We are mainly using go-yaml v3 which seems to be the best option regarding yaml 1.2.

My suggestion would be to replace https://github.com/ghodss/yaml by something using go-yaml v3 (maybe by the change started in #384) and patch further bugs by contributing to go-yaml v3 directly.

@seabass-labrax
Copy link
Contributor Author

I've just made pull request #556 to document the present support for YAML 1.1 and that YAML 1.2 support is being added! :)

@6543
Copy link
Member

6543 commented Dec 6, 2021

@seabass-labrax can you paste an 1.2 yaml example to test against here?

6543 added a commit to 6543-forks/woodpecker that referenced this issue May 18, 2022
@6543 6543 modified the milestones: 1.0.0, 0.15.0 May 18, 2022
@6543 6543 closed this as completed May 18, 2022
6543 added a commit that referenced this issue May 19, 2022
* close #517

* sed -i 's/Yaml/YAML/g'

* Update docs/docs/20-usage/10-intro.md

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>

Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
@6543 6543 reopened this May 24, 2022
@6543
Copy link
Member

6543 commented May 24, 2022

We mostly do support yaml 1.2 but not completly :/

@6543
Copy link
Member

6543 commented May 24, 2022

only YAML 1.1 is accepted -> https://codeberg.org/6543/ci_yaml-test/commits/branch/main

else you get 400 -> failure to parse YAML from hook back (web-hook response)

this has to do with https://gopkg.in/yaml.v3 lib

@qwerty287 qwerty287 modified the milestones: 0.15.0, 1.0.0 Oct 11, 2022
@6543 6543 modified the milestones: 1.0.0, 1.1.0 Mar 20, 2023
@pat-s pat-s modified the milestones: 2.0.0, 2.x.x Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature add new functionality
Projects
None yet
Development

No branches or pull requests

5 participants